Jump to content

Recommended Posts

Posted

Hi guys

I've been searching for this but I couldnt find it

I have 2 browsers on my GUI (wb1 and wb2)

when I click on a button (btn1) a page loads on wb1. Then I want to click a link on the page that loaded on wb1 and I want that page to open on wb2.

How can I make that?

thanks in advanced

Posted

IE Fires a BeforeNavigate2() Event before it's about to navigate to a new page. Unfortunately it looks like AutoIt isn't able to cancel navigation by setting $cancel = True...there are a few [older] threads in the forums about this. I've come up with this, kind of works:

#include <IE.au3>
Dim $wb1 = _IECreate("http://www.google.com")
Dim $wb1Events = ObjEvent($wb1, "_IEEvent_", "DWebBrowserEvents2")

While 1
    Sleep(100)
WEnd

Func _IEEvent_BeforeNavigate2($IEpDisp, $IEURL, $IEFlags, $IETargetFrameName, $IEPostData, $IEHeaders, $IECancel)
    ;Use IEURL to open the link in wb2
    ConsoleWrite("BeforeNavigate2 Fired - Navigate to: " & $IEURL & @CRLF)
    $wb1.Stop
EndFunc   ;==>_IEEvent_BeforeNavigate2

Basically it listens for the event on wb1 and immediately stops the action. It also places the intended destination URL in the console. Use _IENavigate() on $wb2 to make IT go to $IEURL...

_IENavigate($wb2, $IEURL)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...