Jump to content

Recommended Posts

Posted (edited)

As it is right now, running

#include <IE.au3>
$Browser1 = _IECreate("www.facebook.com")
$Browser2 = _IECreate("www.facebook.com")

Opens up two different IE Explorer windows with both of them being at facebook.com

Now, If I login to facebook on Browser1, and then go to Browser2 and refresh the page, I will be logged in on both of them. This is because they're sharing cookies and everything.

How can I make them both completely separate from each other? Like I want it to be like they're both isolated from everything else on the machine, in the same way like opening up one IE normally and then having another IE in Private Browsing Mode. They're both completely separate.

Any ideas?

Edited by Dgameman1
Posted

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 2/29/2016 at 12:04 AM, Dgameman1 said:

I'm running Windows 10 with Internet Explorer 11

Expand  

Just like me.

Try this:

Run('"C:\Program Files (x86)\Internet Explorer\iexplore.exe"  -private http://bing.com')

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 2/29/2016 at 12:07 AM, mLipok said:

Just like me.

Try this:

Run('"C:\Program Files (x86)\Internet Explorer\iexplore.exe"  -private http://bing.com')

 

Expand  

But if I wanted 3 separate sessions that wouldn't work, because the two private sessions would be sharing.

From what I've looked online, the IE11 actually breaks New Session, and the only way to go about doing it is using iexplore.exe -noframemerging -private which is now working perfectly :)

Posted

Hmmm... 

Strange. This follownig snippet should work:
 

RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main','SessionMerging','REG_DWORD','00000001')
Run('"C:\Program Files (x86)\Internet Explorer\iexplore.exe"  -nosessionmerging -private https://www.autoitscript.com/forum')

https://msdn.microsoft.com/library/hh826025(v=vs.85).aspx

‑nosessionmerging Internet Explorer 8 and later versions. Internet Explorer 8 and later versions. Prevents Internet Explorer from merging tab processes and thus sharing session cookies across tabs. Even if you have the –framemerging feature turned on (which it is by default; see above), specifying this option will isolate your tabs into separate processes and prevent session sharing, even if those tabs are associated with the same frame process. You can also set this option via registry key:
 
 
HKEY_CURRENT_USER
   SOFTWARE
      Microsoft
         Internet Explorer
            Main
               SessionMerging
                  (DWORD) 00000000

The feature is enabled when the value is set to (DWORD) 00000001 and disabled when the value is (DWORD) 00000000. By default, it is enabled.

For more info, see Session management within Internet Explorer 8.0, Session Cookies, sessionStorage, and IE8, and Understanding Session Lifetime.

but ......

here:

https://blogs.msdn.microsoft.com/ie/2009/05/06/session-cookies-sessionstorage-and-ie8-or-how-can-i-log-into-two-webmail-accounts-at-the-same-time/

  Quote

Update 1/11/2010: Someone recently asked if there’s a way to start a “NoMerge” session via the CoCreateInstance COM API rather than by directly executing iexplore.exe with the command line parameter. Unfortunately, that scenario is not presently supported. In contrast, the IELaunchURL API always launches IE using the NoMerge option. 

Expand  

IELaunchURL function:  https://msdn.microsoft.com/en-us/library/aa767962(VS.85).aspx

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I didn't have to change the registry for it to work which is nice.

I'm sure that I'm just now missing something stupid in my code, for some reason, it's not able to attach to the new IE

#include <IE.au3>
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")
WinWait("Navigation Canceled - Internet Explorer - [InPrivate]")
$h_IEhandle = WinGetHandle("Navigation Canceled - Internet Explorer - [InPrivate]", "title")
$Site = _IEAttach($h_IEhandle)
_IENavigate($Site, "google.com")

These are the errors I get

  Quote

--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidDataType

Expand  

And this is what AutoIt Window Info shows

qn0jJYx.png

 

Posted

here is next example:

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <array.au3>
#include <ie.au3>
#include <WinAPIProc.au3>

_IEErrorHandlerRegister(_ErrFunc)


_Example()
Func _Example()
    Local $iPID = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")

    Local $hwnd = 0
    Local $oIE

    ConsoleWrite('$iPID = ' & $iPID & @CRLF)

    While 1
        $hwnd = _WinAPI_EnumProcessWindows($iPID, False)
        If @error = 0 Then
            $hwnd = $hwnd[1][0]
            ConsoleWrite('$hwnd = ' & $hwnd & @CRLF)

            $oIE = _IEAttach($hwnd, 'hwnd')
            _IENavigate($oIE, "google.com")
            If Not @error Then ExitLoop
        EndIf

        Sleep(100)

    WEnd


EndFunc    ;==>_Example

 

But something sill is not working fine.
I'm tired, going sleep (02:00 AM)

 

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
#include <ie.au3>
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main','SessionMerging','REG_DWORD','00000000')
Run('"C:\Program Files (x86)\Internet Explorer\iexplore.exe"  -nosessionmerging -private https://www.autoitscript.com/forum')
Sleep(5000)
$oIE = _IEAttach('www.autoitscript.com', 'url')
_IENavigate($oIE, "google.com")

now going sleep ....

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 2/29/2016 at 1:43 AM, mLipok said:
#include <ie.au3>
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main','SessionMerging','REG_DWORD','00000000')
Run('"C:\Program Files (x86)\Internet Explorer\iexplore.exe"  -nosessionmerging -private https://www.autoitscript.com/forum')
Sleep(5000)
$oIE = _IEAttach('www.autoitscript.com', 'url')
_IENavigate($oIE, "google.com")

now going sleep ....

 

Expand  

Lmao. Go get some sleep!

I'll work on fixing it so that there's no sleep needed. THanks =]

Posted

Did you try my last example ?
Have you made some better one ?

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 year later...
Posted

Hi I was recently going through this thread and others regarding making separate IE instances that do not share cookies. I have tried two things and neither seem to be working. First thing is the registry edit. I set FrameMerging to 0 in the registry as per Microsoft's site, but AutoIt continues to launch IE instances with FrameMerging. The registry edit only works when I launch IE manually outside of AutoIt. If this worked, this would be the optimal solution. The other thing I tried is launching IE in AutoIt with Run() and using the -noframemerging parameter, but I cannot seem to get the HWND of the window. I tried using a function, which I will post below, that gets the PID and then the HWND from the IE instance. I think there is an issue with the way disabling frame merging makes the IE instances behave. I would greatly appreciate a solution to this problem. 

Function I used

Func _WinGetByPID($iPID, $iArray = 1) ; 0 Will Return 1 Base Array & 1 Will Return The First Window.
    Local $aError[1] = [0], $aWinList, $sReturn
    If IsString($iPID) Then
        $iPID = ProcessExists($iPID)
    EndIf
    $aWinList = WinList()
    For $A = 1 To $aWinList[0][0]
        If WinGetProcess($aWinList[$A][1]) = $iPID And BitAND(WinGetState($aWinList[$A][1]), 2) Then
            If $iArray Then
                Return $aWinList[$A][1]
            EndIf
            $sReturn &= $aWinList[$A][1] & Chr(1)
        EndIf
    Next
    If $sReturn Then
        Return StringSplit(StringTrimRight($sReturn, 1), Chr(1))
    EndIf
    Return SetError(1, 0, $aError)
EndFunc   ;==>_WinGetByPID

 

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...