I have two AutoIt scripts. Both contain Global $oIE = _IECreate($myUrl, 1)
. They create two IE windows for the same URL.
In IE, when selecting "new session" from "file" menu, each window gets its own session. But using two different script files at the same time, both windows login to the same account. How can I open every IE window with a new session?
Sessions relate to each unique iexplore.exe process. Start new instance of iexplore.exe per required session (untested, no error checking) :
#include <IE.au3>
Global Const $g_sUrl = 'https://stackoverflow.com/'
Global $g_aIE[2]
For $i1 = 0 To UBound($g_aIE, 1) -1
_IECreateSession($g_aIE[$i1], $g_sUrl)
Next
Func _IECreateSession(ByRef $oIE, Const $sUrl)
Local Const $iPID = ShellExecute('iexplore.exe', '-nosessionmerging about:blank')
Local $aWnd
WinWait('Blank Page')
$aWnd = _WinAPI_EnumProcessWindows($iPID, True)
$oIE = _IEAttach($aWnd[1][1], 'hwnd')
_IELoadWait($oIE)
_IENavigate($oIE, $sUrl)
Return $iPID
EndFunc