Sign in to follow this  
Followers 0
Aeterna

Do something if StringRegExp finds a match?

2 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0