This is not a bug, but a
"Method #1" continuation section. In effect, the line with the
> starts with an expression operator (greater-than), so it gets merged into the previous (non-empty) line. The line with the hotkey, although it starts with
^ (bitwise-xor), is correctly detected and parsed as a hotkey as that has higher priority.
In effect your script is equivalent to this:
Code: Select all
#IfWinActive ahk_exe notepad.exe
^n::MsgBox OK
#IfWinActive >
^z::MsgBox Ctrl-Z pressed
Removing the second #IfWinActive will result in this (which I verified by pressing Ctrl+N with Notepad open):
Code: Select all
#IfWinActive ahk_exe notepad.exe
^n::MsgBox OK >
^z::MsgBox Ctrl-Z pressed
Amusingly, the equivalent AutoHotkey v2 script will result in a load time error, probably as a side effect of changes in expression continuation (trailing operators can now qualify for merging the next non-blank line):
Code: Select all
#HotIf WinActive("ahk_exe notepad.exe")
^n::MsgBox "OK"
#HotIf
>
^z::MsgBox "Ctrl-Z pressed"
Code: Select all
---------------------------
*
---------------------------
Error at line 4.
Line Text: > ^z::MsgBox "Ctrl-Z pressed"
Error: Invalid hotkey.
The program will exit.
---------------------------
OK
---------------------------