sirkerry Posted October 5, 2009 Posted October 5, 2009 What am I doing wrong with the following If Else statment? My intent is for it to check to see if $NoRecs string exists in $sText and if it doesn't then do stuff, but the script just doesn't. $sText = String(_IEBodyReadText ($oIE)) $NoRecs = StringInStr($sText, "No records found for this account.") If $NoRecs <> 0 Then "do stuff" Else EndIf
Pantera975 Posted October 5, 2009 Posted October 5, 2009 What am I doing wrong with the following If Else statment? My intent is for it to check to see if $NoRecs string exists in $sText and if it doesn't then do stuff, but the script just doesn't. $sText = String(_IEBodyReadText ($oIE)) $NoRecs = StringInStr($sText, "No records found for this account.") If $NoRecs <> 0 Then "do stuff" Else EndIf I assume there is more code above this that you have defined $oIE. If that is true then try the following below. Sometimes the source that autoit gets is kinda funky. Try this and see if its what you expect. $sText = String(_IEBodyReadText ($oIE)) $NoRecs = StringInStr($sText, "No records found for this account.") msgbox(-1,"",$sText) msgbox(-1,"",$NoRecs) If $NoRecs <> 0 Then "do stuff" Else EndIf
TurionAltec Posted October 5, 2009 Posted October 5, 2009 $sText = String(_IEBodyReadText ($oIE)) $NoRecs = StringInStr($sText, "No records found for this account.") Msgbox(0,"NoRecs",$NoRecs) If $NoRecs <> 0 Then "do stuff" Else EndIf
sirkerry Posted October 5, 2009 Author Posted October 5, 2009 (edited) I assume there is more code above this that you have defined $oIE. If that is true then try the following below. Sometimes the source that autoit gets is kinda funky.Try this and see if its what you expect.There is. I just didn't see the point of posting the 40 lines of code above the If Else statement since they're working fine. The MsgBox is returning what I'm expecting. The If statement just doesn't seem act on the <> 0 bit. Edited October 5, 2009 by sirkerry
sirkerry Posted October 5, 2009 Author Posted October 5, 2009 Msgbox(0,"NoRecs",$NoRecs) What does the Msgbox tell you? It tells me 0.
sirkerry Posted October 5, 2009 Author Posted October 5, 2009 Thanks guys, but never mind. I figured out what I was doing. I had my logic reversed.
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