Ref:
Code:
WinGet, WinHotkeyErrorID, ID, % "Hot keystroke error"
In that text the word "error" gets capitalized to "Error". This occurs in quotes or without. It definitely changes the behavior of code.
I'm using PSPad and when I F2 I get the dialog "Couldn't get anything to indent". This comes from the following tidy code:
Code:
;If something is selected, do the indentation and put it back in again
If ClipboardString is Space
MsgBox, 0 , %ScriptName%,
(LTrim
Couldn't get anything to indent.
Please try again.
), 1
I thought this might be because I code with CRLF End-Of-Line unless I'm uploading code to a *nix server. I copy/pasted my code into Wordpad. On F2 the entire file was selected and reformatted. I was only expecting the selected text, but OK. I pasted the code into Windows Notepad and hit F2. When it strips out the CR and leaves LF-only EOL, Notepad gets ugly. I think there should be an option to turn off the code that manipulates the EOL markers.
Side note: Personally I prefer the BSD/Rajat style, though it seems the first brace on a function gets indented anyway. Bug? Example:
Code:
MyFunction()
{
If SomeVar<>
{
; Handle it
}
}
;;Next function...
That's a bit inconsistent. No?
Last: As I was looking for scripts in this forum I also came across this link:
http://www.autohotkey.com/forum/viewtopic.php?t=4395
That contains an old version of the formatting code:
ScriptName = Auto-Syntax-Tidy v6.1
; OS=WinXP, AHK=1.0.35.16, Author = Toralf, Co-Author = Hajos
; 2005-06-09, 2005-06-27, 2005-07-10
I highly recommend for the script on that page to be removed and a link inserted to this thread. I know it forward links to 2528 an that links here, but it's not entirely clear as to whether these are both competing scripts or whether the first is obsoleted by the current v12 - and yes, the one here is absolutely better than the other one.
Thanks for the script, guys. I'll add it to my list of "I wonder if I can improve on that when I understand this better...".