Jump to content

open two files with the same code in two different windows


Recommended Posts

i have two files a.au3 and b.au3 the both contains the same code which is :

#include <IE.au3>
#include <MsgBoxConstants.au3>

Global $myUrl = "https://www.autoitscript.com"
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main','SessionMerging','REG_DWORD','00000000')
ShellExecute ("iexplore.exe", " -nosessionmerging about:blank")
WinWait ("Blank Page")
Global $oIE = _IEAttach ("about:blank", "url")
_IELoadWait ($oIE)
_IENavigate ($oIE, $myUrl)

when i launch the both files in the same time two blank windows are opens.

what im waiting for is that every window navigate to the link but what happen is the first and the second file navigate the url to the same window and the seconde window stay about:blank

i think the problem happen because i try to open the same url in both windows

so i need i way to navigate to the same url from two different windows

Thanks in advance

Link to comment
Share on other sites

33 minutes ago, Juvigy said:

That is because you attach to the first window with both scripts. If you remove ShellExceute and change it to IECreate it will work.

i want to do it with ShellExecute because i've already IECreate merge sessions and the same accoutn opened in the boot failed

i have already solved this problem by

ShellExecute ("iexplore.exe", " -nosessionmerging about:blank")

 

is there any way i can do it with ShellExecute and attach any file to the correspondant window

Link to comment
Share on other sites

Yes , but you will have to implement some logic. Check out this example:

Local $i = 1
    While 1
        $oIE = _IEAttach("", "instance", $i)
        If @error = $_IEStatus_NoMatch Then
            $oIE = 0
            ExitLoop
        EndIf
        msgbox(0,0,_IEPropertyGet($oIE, "locationurl"))
        $i += 1
    WEnd

 

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

×
×
  • Create New...