Jump to content

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.

http://quadryders.com/phpcc/snippet.php?sid=77

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")
_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_BeforeNavigate2

What am I doing wrong?

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...