I have an autohotkey script "Main.ahk" that has a few thousand lines with all of my hotkeys.
However, I recently started using an old game emulator (ZX Spectrum lol) and when I am in that, my automation messes up the games, so I have to exit Main.ahk before I run that.
Alternatively, is there a way to put a global directive into Main.ahk that says "if application spectrum.exe is running, then ignore all hotkeys in this script" ?
Pause all hotkeys Topic is solved
Re: Pause all hotkeys Topic is solved
use suspend hotkey, eg. if scroll lock light is on then use default, else use your hotkeys.
Re: Pause all hotkeys
You can create context-sensitive hotkeys by putting a directive above the relevant or all hotkeys:
#IfWin[Not]Active or #IfWin[Not]Exist: Docs
or #If: Docs
Options:
#IfWin[Not]Active or #IfWin[Not]Exist: Docs
or #If: Docs
Options:
Code: Select all
#IfWinNotActive ahk_exe spectrum.exe
space::msgbox Works only if spectrum.exe window is not active
Numpad1::msgbox Another hotkey
; more hotkeys here
#If ; end of 'context-sensitive hotkeys' section - optional
Code: Select all
#IfWinNotExist ahk_exe spectrum.exe
space::msgbox Works only if spectrum.exe window does not exist
; more hotkeys here
#If ; end of 'context-sensitive hotkeys' section - optional
Code: Select all
#If !WinExist("ahk_exe spectrum.exe") ; '!' is logical 'NOT'
space::msgbox Works only if spectrum.exe window does not exist
; more hotkeys here
#If ; end of 'context-sensitive hotkeys' section - optional
Re: Pause all hotkeys
Great, thanks. For my needs, the Suspend is perfect, I'll just use a toggle
^#!s::Suspend, Toggle
I guess the 'Toggle' is redundant as that's the default behaviour.
Thanks also for the overview of all of the IfWin[Not]Active / #IfWin[Not]Exist / #If [!]WinExist options.
^#!s::Suspend, Toggle
I guess the 'Toggle' is redundant as that's the default behaviour.
Thanks also for the overview of all of the IfWin[Not]Active / #IfWin[Not]Exist / #If [!]WinExist options.
Who is online
Users browsing this forum: No registered users and 191 guests