Dim IE
Dim scripts
Dim script_text
'Set IE = CreateObject("InternetExplorer.Application")
Set IE = WScript.CreateObject ("InternetExplorer.Application", "IE_")
With IE
.left=200
.top=200
.height=480
.width=600
.menubar=1
.toolbar=1
.statusBar=1
'
' The code on this page WILL throw an error.
'
.navigate "http://www.delphicommunity.com/teststop.html"
.visible=1
End With
' Don't need the loop because we are using the events
While 1: WSH.Sleep 1000 : Wend
Set IE = Nothing
WScript.Quit(0)
Sub IE_DocumentComplete(ByVal pDisp, URL)
MsgBox "DocumentComplete event raised for URL: " & URL
With IE.Document
Set scripts = ie.document.all.tags("script")
For x = 0 to scripts.length-1
script_text = scripts(x).text
If InStr(script_text, "alert") > 0 Then
scripts(x).text = "function stopError() {return true;}window.onerror = stopError;"
End If
script_text = scripts(x).text
MsgBox(script_text)
Next
End With
End Sub
Sub IE_OnQuit()
MsgBox "IE quits"
WSH.Quit
End Sub
|