Dgameman1

Start IE hidden without using _IECreate

9 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  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

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

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

Share this post


Link to post
Share on other sites
2 minutes ago, 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.

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

Share this post


Link to post
Share on other sites

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.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

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

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

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)

 

Share this post


Link to post
Share on other sites

@Dgameman1

You should try to use this:

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

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

11 hours ago, mLipok said:

@Dgameman1

You should try to use this:

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

 

 

$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

Share this post


Link to post
Share on other sites

#9 ·  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

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