JohnOne Posted June 28, 2012 Posted June 28, 2012 (edited) EDIT: I was looking at this arse ways about, and did not need any EventScript Inserted. I'm trying to analyze a url before I navigate to it and if necessary cancel the navigation. I'm looking at BeforeNavigate2 event, which I can capture successfully using ObjEvent(). But I would like to insert code into the page to deal with that event. I'm having no luck, and there are no working examples of this on the forum. Here is my latest minimalistic code. #include <IE.au3> $oIE = _IECreate("http://www.google.com") _IEHeadInsertEventScript($oIE, "document", "BeforeNavigate2", "cancel;") ; No go - tried "return false;" ObjEvent($oIE, "_Evt_","DWebBrowserEvents2") While 1 Sleep(100) WEnd Func _Evt_BeforeNavigate2($IEpDisp, $IEURL) Local $o_link = @COM_EventObj MsgBox(0, 0, $IEURL) ; occurs EndFunc ;==>_Evt_BeforeNavigate2 The MsgBox shows with the url , but navigation still occurs. Anyone successfully done this sort of thing? EDIT: I have tried example 5 in help file for _IEHeadInsertEventScript() but it does not work on all links, perhaps because of frames, or some other such html wizardry. Edited June 29, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted June 29, 2012 Author Posted June 29, 2012 (edited) Shameless Bump, can't find any info on this anywhere EDIT: Is there anyway I could trigger/fire a NavigateComplete2 event, and fool the WebBrowser object into thinking it has completed it's navigation? Edited June 29, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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