PsaltyDS Posted February 3, 2006 Posted February 3, 2006 I had a logic explosion in one of my scripts, and just figured out that 'NOT' does not work in string compares. Is that by design? Demo of my problem: expandcollapse popup; Test string compares $Text1 = "One" $Text2 = "Two" If $Text1 = $Text2 Then MsgBox(32, "Compare with =", '"' & $Text1 & '" is equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with =", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') EndIf If Not $Text1 = $Text2 Then MsgBox(32, "Compare with Not =", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with Not =", '"' & $Text1 & '" is equal to "' & $Text2 & '"') EndIf If $Text1 == $Text2 Then MsgBox(32, "Compare with ==", '"' & $Text1 & '" is equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with ==", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') EndIf If Not $Text1 == $Text2 Then MsgBox(32, "Compare with Not ==", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with Not ==", '"' & $Text1 & '" is equal to "' & $Text2 & '"') EndIf If $Text1 <> $Text2 Then MsgBox(32, "Compare with <>", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with <>", '"' & $Text1 & '" is equal to "' & $Text2 & '"') EndIf If Not $Text1 <> $Text2 Then MsgBox(32, "Compare with Not <>", '"' & $Text1 & '" is equal to "' & $Text2 & '"') Else MsgBox(32, "Compare with Not <>", '"' & $Text1 & '" is not equal to "' & $Text2 & '"') EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
sksbir Posted February 3, 2006 Posted February 3, 2006 helloi have had the same problem : take a look hereIf Not $Text1 = $Text2(not $text1) is first evaluated, and = is evaluated after.Try if not($text1 = $text2)
PsaltyDS Posted February 3, 2006 Author Posted February 3, 2006 helloi have had the same problem : take a look hereIf Not $Text1 = $Text2(not $text1) is first evaluated, and = is evaluated after.Try if not($text1 = $text2)Ahh, I see, said the blind man...Works the same way with numeric compares, I hadn't noticed that. Thanks! I used ta couldn't spell poorgrammer, now I are one! Thanks to the AutoIT3 Forums! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now