how come my AHK interpreted non integer character as integer

Get help with using AutoHotkey and its commands and hotkeys
kwfine
Posts: 16
Joined: 26 Nov 2015, 06:46

how come my AHK interpreted non integer character as integer

01 Jul 2018, 14:47

Hi all,

My AHK Version is 1.1.25.01.

I am learning AHK.
Here is my AHK codes:

Code: Select all

!h::
clipboard := "I am learning 日本語"
word_array := StrSplit(clipboard) 
if word_array[15] is integer
{
msgbox, this is an integer
msgbox % word_array[15]
}

return

When I pressed the combo key to run the above AHK program, the message, "this is an integer" popped up.
I have no idea why it happened, because the word_array[15] is not Integer.

Could you help me out please?

Thank you!

Kitty
lexikos
Posts: 6682
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: how come my AHK interpreted non integer character as integer

07 Jul 2018, 19:48

word_array[15] is not a variable, therefore what you have written is if (expression), not if var is type.
Note: The operators "between", "is", "in", and "contains" are not supported in expressions.
Source: If var is [not] type
It is equivalent to this:

Code: Select all

if word_array[15] . unset_is . unset_integer
That is, because this is an expression and not if var is type, is and integer are merely variables which have not been assigned values. The result of concatenating the value "日" with two empty strings is "日", which is considered to be true since it is neither empty nor zero.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 373 guests