When I use InputHook with KeyOpt "{All}", it catches all the actual keys, ignoring hotkeys defined in the script.
But when I include #HotIf, hotkeys start to affect what InputHook is getting.
In my script I need InputHook to get keys unchanged by hotkeys, and I also need #HotIf.
I tried messing around with Critical and InputLevel, but couldn't get it to work. Not even sure what I'm looking for tbh.
Here's the code. When I press "q", then "z" without #HotIf, msgbox gives "z".
With #HotIf, it gives "a". I want it to be "z" with #HotIf, not sure how to do that.
AutoHotkey 2.0-a131-2327728b
Code: Select all
#singleinstance force
get_key(){
ih := InputHook()
ih.KeyOpt("{ALL}", "ES")
ih.Start()
ih.Wait("2")
return ih.EndKey
}
; #HotIf WinActive("File Explorer")
q::msgbox(get_key())
z::send("a")