Jump to content
Sign in to follow this  

Logging IE URL / Post info to the console

Recommended Posts


Long ago, there was a snippet posted that described how you can log URLs to the console

with IE.


However, when I try this code now, IE hangs and throws an error on the console saying:

Warning from function _IEAttach

In an attempt to fix these problems, I tried to rewrite using the more modern

BeforeNavigate2 events. However, in what is probably complete Windows programming

ignorance on my part, the code below still does not work... in particular, I can

surf, IE9 is stable; however, I am not seeing the data sent to the console, when I

compile it with the console option enabled.

#include <IE.au3>

ShellExecute("iexplore.exe", "about:blank")
WinWait("Blank Page")
$oIE = _IEAttach("about:blank", "url")
_IENavigate($oIE, "http://www.dell.com")
$oEvt = ObjEvent($oIE, "_IEEvent_")

While 1

; 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_BeforeNavigate2

What am I doing wrong?

Share this post

Link to post
Share on other sites


changed this line and it works

$oEvt = ObjEvent($oIE, "_IEEvent_","DWebBrowserEvents2")


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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.