If window is active, then... Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Silverfish

If window is active, then...

15 Dec 2017, 13:51

Wondering what I'm doing wrong. I'm trying to run this scrip ONLY if I'm in a game window and nothing else.

Code: Select all

4::

KeyWait, 4
If WinActive("ahk_class WindowsForms10.Window.8.app.0.2eeeb2e_r9_ad1")
	{
	Send 4
	Sleep 1000
	Send 5
	}
	Return
There are no errors or "symptoms", it simply does nothing. :/

Thanks!
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: If window is active, then...  Topic is solved

16 Dec 2017, 02:38

Hallo,
maybe the ahk_class will change all the time?
Try:

Code: Select all

$4:: ;$ necessary if the script uses the Send command to send the hotkey itself
SetTitleMatchMode, RegEx
KeyWait, 4
If WinActive("ahk_class WindowsForms10.Window.8.app")
{
	Send 4
	Sleep 1000
	Send 5
}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 61 guests