Jump to content

Do something if StringRegExp finds a match?


Recommended Posts

CODE
#include <IE.au3>

$oIE = _IECreate()

_IENavigate($oIE, "www.example.com")

_IELoadWait($oIE)

func CheckError()

$body = _IEBodyReadText($oIE)

$error = StringRegExp($body, "You have", 0)

If $error = 1 Then

MsgBox = "Error"

EndIf

EndFunc

CheckError()

Shouldn't this code work? Please let me know whats wrong!

Edited by Aeterna
Link to comment
Share on other sites

does this work? I neatened it a bit and removed some unneccessary functions.

#include <IE.au3>

$oIE = _IECreate("www.example.com")
_IELoadWait($oIE)
CheckError()

func CheckError()
   Local $body

   $body = _IEBodyReadText($oIE)
      If StringRegExp($body, "(You have)", 0) Then
         MsgBox (48, "Error", "There was an error loading interent explorer")
      EndIf

EndFunc; ==> CheckError
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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