Jump to content

Recommended Posts

Posted

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
Posted

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
Posted

$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

Posted (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 by sirkerry

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...