"if..is type" not working with a property of an object Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rhaos
Posts: 12
Joined: 12 Feb 2020, 07:53

"if..is type" not working with a property of an object

09 Aug 2020, 08:18

i have an object and a string as its property
when i check its property is really a string, its not working..
a code i tried is below

Code: Select all

o:={},o.var:="str"
if o.var is number
    OutputDebug, true ; debug console output: true
if o.var is space
    OutputDebug, true ; debug console output: true
please let me know proper way
Thank you for help!
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: "if..is type" not working with a property of an object  Topic is solved

09 Aug 2020, 08:48

it doesnt work due to the documented limitation of If Var Is Type that it only accepts plain variables and doesnt work with expressions.
write urself a type function wrapping If Var Is Type or use one of the numerous ones other people have already posted on the forums or other places on the internet. dig around

this also applies to ur other thread(where the issue is that if var is type cant be used in expressions)
rhaos
Posts: 12
Joined: 12 Feb 2020, 07:53

Re: "if..is type" not working with a property of an object

09 Aug 2020, 09:32

Thank you swagfag!
it was my lackness..
now i found it you mentioned in ahk help doc
Note: The operators "between", "is", "in", and "contains" are not supported in expressions.
sorry for my stupid question
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: "if..is type" not working with a property of an object

09 Aug 2020, 10:08

not a stupid question, ahk limitation

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest, ArkuS, Bing [Bot], BPet and 121 guests