mikepenn Posted January 8, 2012 Share Posted January 8, 2012 Long ago, there was a snippet posted that described how you can log URLs to the consolewith IE. http://quadryders.com/phpcc/snippet.php?sid=77However, when I try this code now, IE hangs and throws an error on the console saying:Warning from function _IEAttachIn an attempt to fix these problems, I tried to rewrite using the more modern BeforeNavigate2 events. However, in what is probably complete Windows programmingignorance on my part, the code below still does not work... in particular, I cansurf, IE9 is stable; however, I am not seeing the data sent to the console, when Icompile it with the console option enabled.#include <IE.au3> ShellExecute("iexplore.exe", "about:blank") WinWait("Blank Page") $oIE = _IEAttach("about:blank", "url") _IELoadWait($oIE) _IENavigate($oIE, "http://www.dell.com") $oEvt = ObjEvent($oIE, "_IEEvent_") While 1 Sleep(5000) WEnd ; BeforeNavigate2 method definition Func _IEEvent_BeforeNavigate2($IEpDisp, $IEURL, $IEFlags, $IETargetFrameName, $IEPostData, $IEHeaders, $IECancel) ConsoleWrite("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!--BeforeNavigate2 fired--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " & @CRLF & _ "$IEpDisp = " & $IEpDisp() & " - " & ObjName($IEpDisp) & @CRLF & _ ; e.g. default property and name for the object "$IEURL = " & $IEURL & @CRLF & _ "$IEFlags = " & $IEFlags & @CRLF & _ "$IETargetFrameName = " & $IETargetFrameName & @CRLF & _ "$IEPostData = " & $IEPostData & @CRLF & _ "$IEHeaders = " & $IEHeaders & @CRLF & _ "$IECancel = " & $IECancel & @CRLF & _ "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " & @CRLF & @CRLF) EndFunc ;==>_IEEvent_BeforeNavigate2What am I doing wrong? Link to comment Share on other sites More sharing options...
kylomas Posted January 8, 2012 Share Posted January 8, 2012 mikepenn, changed this line and it works$oEvt = ObjEvent($oIE, "_IEEvent_","DWebBrowserEvents2") kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
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