aleph01

start IE In Private mode

5 posts in this topic

#1 ·  Posted

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. :'(

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted

Thanks, jguinch.  That opens to the library website InPrivate.  However, my __IENavigate line doesn't create the new tab (https://www.google.com).  I just want to create it, and leave forsythpl.org as the active tab.


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

Share this post


Link to post
Share on other sites

#4 ·  Posted

OK, I got it.  __IENavigate does work, I just had to put it in the function.

Thanks jguinch!


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

Share this post


Link to post
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