HowTo get multiple #if expression working? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Neutra
Posts: 3
Joined: 30 Jul 2023, 07:53

HowTo get multiple #if expression working?

08 Oct 2023, 11:52

Hi,

i need a script which has an inbuild gobal on/off toggle hotkey and before executing checks the active window AND the on/off status/blocker.

Unfortunately i can't get it to work.

Code: Select all


SetBatchLines, -1
SetKeyDelay -1
SetTitleMatchMode, 3
#NoEnv		
#KeyHistory 0

#IfWinActive XXXXXXX

~F15::		; Blocker on/off toggle
if(blocker)
{
blocker := false
}
else
{
blocker := true
}
return

[b]#If !blocker AND WinActive XXXXXXX		; here i tried countless different variants[/b]

1::		; just an example
sendinput 2
return

Any help much appreciated.

Thanks
GEV
Posts: 1005
Joined: 25 Feb 2014, 00:50

Re: HowTo get multiple #if expression working?  Topic is solved

08 Oct 2023, 15:34

#If !blocker AND WinActive XXXXXXX
WinActive XXXXX is wrong syntax.

WinActive() is a function and its parameters have to be listed in parentheses. If a parameter is a literal string, it should be enclosed in double quotes:

Code: Select all

#If !blocker AND WinActive("ahk_class Notepad")
Neutra
Posts: 3
Joined: 30 Jul 2023, 07:53

Re: HowTo get multiple #if expression working?

09 Oct 2023, 12:09

I see. Thank you very much, it is working now!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 269 guests