how make ahk pause / suspend when some program run

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DonicBluestorm
Posts: 1
Joined: 17 Apr 2018, 22:09

how make ahk pause / suspend when some program run

21 Apr 2018, 04:52

i want make my ahk script pause or suspend when some games active or running.

i tried

#IfWinActive Notepad
Suspend
#If

but it not working
User avatar
Barney
Posts: 55
Joined: 28 May 2014, 20:03
Location: Germany

Re: how make ahk pause / suspend when some program run

21 Apr 2018, 15:35

you can use WinWait to detect when your game starts.
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Re: how make ahk pause / suspend when some program run

21 Apr 2018, 16:52

it depends what your script does, if it's a bunch of hotkeys then I would use a timer

Code: Select all

#persistent
#singleinstance Force

SetTimer, Check, 500

Check:
If WinActive("ahk_exe notepad.exe") and (!A_IsSuspended)
	Suspend, On
If !WinActive("ahk_exe notepad.exe") and (A_IsSuspended)
	Suspend, Off
return

!a:: ;alt+a
MsgBox, Hello, World!
return
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: how make ahk pause / suspend when some program run

21 Apr 2018, 17:43

If all you need is to selectively disable certain hotkeys why go with through all this ceremony of setting up timers, simply declare your hotkeys inside your #If directive.

If you need to pause a script thats a different thing entirely, so which one is it?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: RandomBoy and 168 guests