Hello!
I have two variables, Var1 and Var2.
Both variables contain text information.
I want to check if the variables contain the letter "u"
if only one variable contain "u", should some things be done
if both variables contain "u" or both lacks "u", nothing shall be done.
How can I make the check?
//Jan
Check changes
Check changes
Last edited by Albireo on 22 Oct 2013, 13:51, edited 1 time in total.
Re: Check changes
Thanks!
it seems to work!
Maybe can be done in a simpler way!
it seems to work!
Maybe can be done in a simpler way!
Code: Select all
#NoEnv
#SingleInstance force
SetBatchLines -1
SetWorkingdir %A_ScriptDir%
AutoTrim On
Var1 = u
Var2 = u
Var1 = o1%Var1%
Var2 = o2%Var2%
If !(( InStr(Var1, "u") and InStr(Var2, "u") ) or ( !InStr(Var1, "u") and !InStr(Var2, "u") ))
MsgBox 64, %A_ScriptName% - Row %A_LineNumber%, Both NOT same .:`nVar1 = %Var1% `nVar2 = %Var2%
Re: Check changes
Code: Select all
If ( !!InStr( Var1,"u" ) + !!InStr( Var2,"u" ) = 1 )
MsgBox Bingo!
The above simplified:
Code: Select all
Condition1 := InStr( Var1,"u" ) ? 1 : 0
Condition2 := InStr( Var2,"u" ) ? 1 : 0
If ( Condition1 + Condition2 = 1 )
MsgBox Do something!
else
If ( Condition1 + Condition2 = 2 )
MsgBox Do nothing!
else
If ( Condition1 + Condition2 = 0 )
MsgBox Do nothing!
Re: Check changes
Great!
Thanks!
Thanks!
Who is online
Users browsing this forum: Bing [Bot], peter_ahk and 138 guests