yucatan Posted December 19, 2011 Share Posted December 19, 2011 (edited) can i embed a page but if a link in that page is clicked it opens the new window in ur normale browser? Edited December 19, 2011 by yucatan Link to comment Share on other sites More sharing options...
JohnOne Posted December 19, 2011 Share Posted December 19, 2011 I imagine you get the link and use _IECreate(link) Or am I missing something? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
yucatan Posted December 20, 2011 Author Share Posted December 20, 2011 yeah u are missing something.i wanne display a google ad that uses javascript. but if u click on it it needs to be opened in a new window here is mij code: expandcollapse popup; ******************************************************* ; Example 1 - Trap COM errors so that 'Back' and 'Forward' ; outside of history bounds does not abort script ; (expect COM errors to be sent to the console) ; ******************************************************* ; #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "http://freegamehosting.nl/ad.php") ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://freegamehosting.nl/ad.php") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() Exit Link to comment Share on other sites More sharing options...
JohnOne Posted December 20, 2011 Share Posted December 20, 2011 I see, well I' not much help then but can offer a suggestion of something to try. Only a suggestion, I don't know how to accomplish this myself. Here is what you will need to do, and I might get some terms wrong. Register an event (if register is the word) with your $oIE objest using ObjEvent() The Event you want to action on is "BeforeNavigate" I think the first param you receive from that is the URL it wants to go to (See help file) Make some sort of comparison of the web address you expect Create a new window based on that data. The part I do not know how to do, is than stop the navigation of your own object, perhaps someone more clued up will tell you. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DaleHohm Posted December 20, 2011 Share Posted December 20, 2011 ObjEvent will not allow you to stop a navigation - AutoIt should be thought of only as being notified of events, not as being in the event loop as Javascript on the page is. Two techniques I have used... one is to inject Javascript onto the page to be able to control the BeforeNavigate event as descripted above (_IEHeadInsertEventScript)... the other is to parse through the objects to find the offending link and rewrite the HTML associated with it. Both are pretty complex interventions. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JohnOne Posted December 20, 2011 Share Posted December 20, 2011 Ah, that's good to know. If I had cause to try such a thing, I most definitely would have wound up with a nasty old hack I'd have done what I described, then after seeing it never worked, I'd have added code to go back a page :embarrassed smiley: AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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