Code: Select all
Hotkey, % "w", testkeys
return
testkeys:
msgbox a
return
#ifwinactive, test
return
Is there away to change this up so that the hotkey works without removing the hotkey, % "w", testkeys part and the #ifwinactive part?
Code: Select all
Hotkey, % "w", testkeys
return
testkeys:
msgbox a
return
#ifwinactive, test
return
src.To turn off context sensitivity (that is, to make subsequently-created hotkeys work in all windows), specify any If sub-command but omit the parameters. For example: Hotkey, If or Hotkey, IfWinActive.
If "Hotkey If" is never used by a script, the bottommost use of any #If or #IfWin directive (if any) will be in effect for the Hotkey command.
Code: Select all
Hotkey, % "w", testkeys
return
testkeys:
msgbox a
return
hotkey, ifwinactive, test
return
Code: Select all
hotkey if
Hotkey, % "w", testkeys
return
testkeys:
msgbox a
return
#ifwinactive, test
; my hotkeys for window "test"
After a bit more testing, that's what I noticed too. In the end I opted forHelgef wrote: ↑17 Feb 2020, 10:45It should be,The line you replaced #ifwinactive, test with will never be executed and has no effect on the script.Code: Select all
hotkey if Hotkey, % "w", testkeys return testkeys: msgbox a return #ifwinactive, test ; my hotkeys for window "test"
Cheers.
Code: Select all
Hotkey, % "w", testkeys
return
testkeys:
msgbox a
return
#ifwinactive, test
return
#ifwinactive ;<this has been added
Users browsing this forum: Google [Bot], peter_ahk and 362 guests