boolean in hotkey command

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

boolean in hotkey command

21 Aug 2019, 15:13

the below code doesn't work.

Code: Select all

var := true
Hotkey if, winexist("ahk_exe Explorer.EXE") and (var)
	Hotkey F2, on
return


#if winexist("ahk_exe Explorer.EXE") and (var)
	F2:: msgbox yes



#if
	*Esc:: ExitApp

fixed it by changing 'and' to '&&', but can't we use 'and'?
gregster
Posts: 9064
Joined: 30 Sep 2013, 06:48

Re: boolean in hotkey command

21 Aug 2019, 23:42

The hotkey docs say:
https://www.autohotkey.com/docs/commands/Hotkey.htm#Parameters wrote:If, Expression
[...]
Known limitation: If Expression contains an and/or operator, it is not recognized as an existing expression. As a workaround, use the equivalent &&/|| operator in both the original #If expression and the one passed to the Hotkey command.
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

Re: boolean in hotkey command

22 Aug 2019, 14:55

I see, thanks for showing me.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 189 guests