Jump to content

Recommended Posts

Posted

I'm currently trying to run IE with a few command line arguments 

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")

The Help File shows that there are parameters for Run that allow me to make it start hidden `@SW_HIDE`

I tried

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private", "", @SW_HIDE)

But that doesn't seem to do anything.

Any ideas?

Posted (edited)

Never tried, but I imagine you could embed an instance of IE in a window (frame) and hide that.

P.S. By window, I mean GUI ... one that is just a frame.

The perils of not including your title in the post text ... and me having a short memory.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted
  On 2/29/2016 at 8:22 AM, TheSaint said:

Never tried, but I imagine you could embed an instance of IE in a window (frame) and hide that.

P.S. By window, I mean GUI ... one that is just a frame.

Expand  

Well I'm able to use

_IEAction($Site, "invisible") 

to get the window invisible, but I'd like for it to start out that way

Posted

Short of IE having a command-line switch to hide, you may be out of luck, if not embedding.

You could start with it minimized perhaps, or off-screen, then hide it.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted (edited)

Your edit :P

The reason I can't just use _IECreate is because I need IE to be opened up with two parameters '-noframemerging' and '-private'

I'm using

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")

$Site = _IEAttach("about:blank1-2", "url")

How can I set the coordinates of where IE starts with the Run command? So I can run it off screen

Edited by Dgameman1
Posted

Try this :

#Include <IE.au3>

Local $sPFDir = (StringInStr(@OSArch, "64") AND Not @AutoItX64) ? RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") : @ProgramFilesDir
ShellExecute ($sPFDir & "\Internet Explorer\iexplore.exe", "about:blank -noframemerging -private", @ProgramFilesDir & "\Internet Explorer","",  @SW_MINIMIZE)

Local $hPrivateIE = WinWait("[REGEXPTITLE:.+\[InPrivate\]$]")
WinSetState($hPrivateIE, "", @SW_HIDE)

Local $oPrivateIE = _IEAttach($hPrivateIE, "hwnd")

;~ _IENavigate($oPrivateIE, "www.autoitscript.com/forum")
;~ WinSetState($hPrivateIE, "", @SW_MAXIMIZE)

 

Posted

@Dgameman1

You should try to use this:

But how I said this example need to work a litle on it.

 

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 4:42 PM, mLipok said:

@Dgameman1

You should try to use this:

But how I said this example need to work a litle on it.

 

Expand  

 

$Site = _IECreateNew("www.website.com")

Func _IECreateNew($s_url = "about:blank")
    ; Create an IE browser in a new process, attach to it and navigate to spcified URL
    ; Returns browser object on success
    ; Returns 0 on failure and sets @error to 1 (timeout waiting for browser)  or 2 (attach failed)

    Local $h_IEhandle, $o_IE

    Global $RunWebsite = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")


    If Not WinWait("Navigation Canceled - Internet Explorer - [InPrivate]", "", 60) Then ; Expected IE window did not appear
        Return SetError(1, 0, 0)
    EndIf

    ;$h_IEhandle = WinGetHandle("Navigation Canceled - Internet Explorer - [InPrivate]")
    $o_IE = _IEAttach("about:blank1-2", "url")

    If Not IsObj($o_IE) Then ; attach failed
        Return SetError(2, 0, 0)
    EndIf

    _IENavigate($o_IE, $s_url)
    Return $o_IE
EndFunc   ;==>_IECreateNew

 

Edited by Dgameman1
  • 1 month later...
Posted (edited)

Any ideas? Using this code, how can I make it invisible right away?

Func _IECreateNew($s_url = "about:blank", $invisible = 0)
    ; Create an IE browser in a new process, attach to it and navigate to specified URL
    ; Returns browser object on success
    ; Returns 0 on failure and sets @error to 1 (timeout waiting for browser)  or 2 (attach failed)

    Local $h_IEhandle, $o_IE

    Global $RunWebsite = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe about:blank1-2 -noframemerging -private")
    If $invisible Then
        _IEAction($RunWebsite, "invisible")
    EndIf

    If Not WinWait("Navigation Canceled - Internet Explorer - [InPrivate]", "", 60) Then ; Expected IE window did not appear
        Return SetError(1, 0, 0)
    EndIf

    ;$h_IEhandle = WinGetHandle("Navigation Canceled - Internet Explorer - [InPrivate]")
    $o_IE = _IEAttach("about:blank1-2", "url")

    If Not IsObj($o_IE) Then ; attach failed
        Return SetError(2, 0, 0)
    EndIf

    _IENavigate($o_IE, $s_url)
    Return $o_IE
EndFunc   ;==>_IECreateNew

I also get the occasional error that it was not able to attach

Edited by Dgameman1

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