If you use
ListHotkeys with HjP's original script, it will show a single reg hotkey:
Code:
Type Off? Running Name
-------------------------------------------------------------------
reg x
There are two reasons for this:
- $ must be applied to the first instance of the hotkey.
- #IfWin causes the keyboard hook to be used only if it is necessary. That is, the keyboard hook is normally required to decide whether the keystroke should be passed through to the system. Since in this case there is a global, non-suspended variant of the hotkey, it will necessarily never be passed through to the system, so the keyboard hook is not required.
HjP wrote:
Returns are not necessary, since the hotkey definitions comprise each only a single line.
The second hotkey is a single line hotkey. The first hotkey is not, since there is no command to the right of "::". It is similar to the following, which specifies multiple criteria for a single hotkey:
Code:
#IfWinActive AnyName
x::
#IfWinActive OtherName
x::
#IfWinActive ; Reset for any other hotkeys below.
Send x
return
y::MsgBox This hotkey is not context-sensitive.