Took me a few days to notice but in one of my scripts the user can define
Esc & hotkey and when they do I use the ~ as the ESC key is also needed to be able to close windows & actions in the program (Total Commander and various child windows) - I've isolated the hotkey setup from my script. Up till now the "hotkey" was blocked e.g. the "a" wasn't sent to notepad, but with the test version the "a" does appear in the notepad window.
Not sure if my original solution was actually faulty and the new behaviour is correct, but just in case (code isn't pretty):
Code: Select all
#NoEnv
#SingleInstance, force
; ~ native function will not be blocked
; $ prefix forces the keyboard hook to be used to implement this hotkey
; notepad as test here, but in my script a group of windows which require ESC close the window/cancel action
Hotkey, IfWinActive, ahk_exe notepad.exe
hk_prefix:="$"
FGHKey:="Esc & a"
HotKeyState:="On"
; source of FGHKey is a setting from an XML file hence the replacements to prevent errors
StringReplace, FGHKey, FGHKey, &`;amp`;, & , All
StringReplace, FGHKey, FGHKey, &`;, &, All
If (InStr(FGHKey,"ESC")) ; needed so we can still use ESC to close/cancel
hk_prefix:="~"
Hotkey, % hk_prefix FGHKey, TestLabel, %HotKeyState% ; %
Return
TestLabel:
MsgBox % A_AhkVersion
Return
Result until and including 1.1.33.08 -> Just show MsgBox
Results 1.1.34-TEST+ga6a1a580 -> Shows MsgBox BUT also allows 'a' to be sent to Notepad window, this is a change in behaviour compared to all previous versions.