ahk says 'panda' is a number, help!

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Murica
Posts: 29
Joined: 27 Nov 2022, 17:28

ahk says 'panda' is a number, help!

Post by Murica » 03 Dec 2022, 02:40

Code: Select all

x=panda
if (x is number && x>1000)
	msgbox, yes %x% is a number

gregster
Posts: 9056
Joined: 30 Sep 2013, 06:48

Re: ahk says 'panda' is a number, help!

Post by gregster » 03 Dec 2022, 02:42

https://www.autohotkey.com/docs/commands/IfIs.htm#Remarks wrote:The "is" operator is not supported in expressions.

Rohwedder
Posts: 7679
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: ahk says 'panda' is a number, help!

Post by Rohwedder » 03 Dec 2022, 03:55

Hallo,
exactly! Therefore:

Code: Select all

x=panda
if x is number
	x>1000
		msgbox, yes %x% is a number > 1000
or:

Code: Select all

x=panda
if Is(x, "number") && x>1000
	msgbox, yes %x% is a number > 1000

Is(Var, Typ) {
	if Var is %Typ%
		Return, True
	Return, False
}
Last edited by Rohwedder on 03 Dec 2022, 04:57, edited 1 time in total.

User avatar
Murica
Posts: 29
Joined: 27 Nov 2022, 17:28

Re: ahk says 'panda' is a number, help!

Post by Murica » 03 Dec 2022, 04:21

ty !

Post Reply

Return to “Ask for Help (v1)”