|
|
Hi,
basically "==" operator means "is the same" while "~=" operator means "one string contains other". So for example it is true that "THIS_STRING"~="IS_STR". This ~= operator can be only used for strings (texts) and not for numbers.
Here is a sample code that could help.
<cmds>
<varset>("vStr1=Hello, World!","")
<varset>("vStr2=Wor","")
<if_str>("vStr1~=vStr2")
<msg>(-100,-100,"Yes, one string contains ~= other","Message",1,0,0,1)
<endif>
<if_str>("vStr1==vStr2")
<msg>(-100,-100,"This should never happen!","Message",1,0,0,1)
<else>
<msg>(-100,-100,"Correct, the strings are not identical ==","Message",1,0,0,1)
<endif>
>>> i think i sometimes gets lost in the difference between number vs string variables.
It just depends on macro logic what kind of data is in variable. For example if you have two variables that contains X and Y position of a pixel on the screen, then you know the variable always contains number and you want to use numerical operations, for example:
<if_num>("vX > 100")
but you do not want let the macro work with the data as strings like do this:
<if_str>("vX > 100")
Best regards,
Petr |
IP Logged
|