Jump to content

start IE In Private mode


Recommended Posts

I'm having issues trying to start IE In Private mode with two tabs, http://www.forsythpl.org is the active tab, https://www.google.com is the second tab.  Using _IECreate and _IENavigate, I can open the browser and navigate, but not In Private mode.  Using ShellExecute, I can open In Private mode, but navigation is not working.

This code works fine except the browser isn't In Private mode:

#include <IE.au3>
$sURL = "http://www.forsythpl.org"
$oIE =_IECreate($sURL, 0, 1, 1)
__IENavigate($oIE, "https://www.google.com", 0, 0x1000)

This code opens IE In Private mode but doesn't navigate:

#include <IE.au3>
$sURL = "http://www.forsythpl.org"
$oIE = ShellExecute ("C:\Program Files (x86)\Internet Explorer\iexplore.exe", "-private")
_IENavigate ($oIE, $sURL)
__IENavigate($oIE, "https://www.google.com", 0, 0x1000)

Can someone show me a way to open IE In Private mode with the two tabs?

Thanks in advance.

Meds.  They're not just for breakfast anymore. :'(

Link to comment
Share on other sites

Try this one :

#Include <IE.au3>

Local Const $navOpenInNewTab = 0x0800
Local $sURL = "http://www.forsythpl.org"

Local $oIE = _IECreatePrivate($sURL)
$oIE.Navigate2('http://www.autoitscript.com/forum', $navOpenInNewTab)

Func _IECreatePrivate($sURL = "", $iWait = 1)
    Local $iPid = ShellExecute ("iexplore.exe", "-private about:blank")
    If Not $iPid Then Return SetError(1, 0, 0)
    Local $hIEPrivate = WinWait("[REGEXPTITLE:\[InPrivate\]$]")
    Local $oIEPrivate = _IEAttach($hIEPrivate, "hwnd")
    If @error Then Return SetError(2, 0, 0)
    _IENavigate($oIEPrivate, $sURL, $iWait)
    Return $oIEPrivate
EndFunc

 

Edited by jguinch
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

  • Recently Browsing   0 members

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