Sign in to follow this  
Followers 0
MichaelO

Opening new IE instance

7 posts in this topic

I'm trying to open a new IE instance (not a new window) such that an additional IEXPLORE.exe process exists and shows up in Task Manager. (Another application requires that my URL is running in its own IE instance.)

When I use _IECreate($webpage), it seems to use the same instance of IEXPLORE.exe that is already running. Is that what is supposed to happen? Is there another _IE function that does what I am looking for?

I have tried using ShellExecute("iexplore.exe",$webpage) and that seems to work. I'll use that if necessary.

Also, can someone point me to something that explains the difference between shellexecute and run? I read the help file, but I must be missing what distinguishes them.

Thanks for your help.

Share this post


Link to post
Share on other sites



Well what _IECreate() does is basically this:

$o_object = ObjCreate("InternetExplorer.Application")
$o_object.visible=1

So I guess that it's the creation of the object that is using an already running IE instance. Using your method is fine, if you want to work with that IE later you'll need _IEAttach()

About ShellExecute... well I don't know the 'technical' difference, but i can see it :)

Run will allow you to run any external program and pass parameters to it, but it can only be a program (EXE, BAT, COM, or PIF)

ShellExecute will let you run programs and any other file type wit its default application. You also have the 'verb' parameter:

The "verb" to use, common verbs include:

open = (default) Opens the file specified. The file can be an executable file, a document file, or a folder

edit = Launches an editor and opens the document for editing. If "filename" is not a document file, the function will fail

print = Prints the document file specified. If "filename" is not a document file, the function will fail

properties = Displays the file or folder's properties

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'm trying to open a new IE instance (not a new window) such that an additional IEXPLORE.exe process exists and shows up in Task Manager. (Another application requires that my URL is running in its own IE instance.)

When I use _IECreate($webpage), it seems to use the same instance of IEXPLORE.exe that is already running. Is that what is supposed to happen? Is there another _IE function that does what I am looking for?

No, it doesn't. Can you post a reproducer that will show that happening? Demo script below opens two different instances every time. Wrong again! :)

I have tried using ShellExecute("iexplore.exe",$webpage) and that seems to work. I'll use that if necessary.

Also, can someone point me to something that explains the difference between shellexecute and run? I read the help file, but I must be missing what distinguishes them.

ShellExecute() can be used with non-executables, like a URL or folder path. The shell will determine what to run based on file extention, etc., just like if typed in the Start|Run dialog. Run() requires an actual executable, which is why if you want to run a CMD.exe embedded command like "DIR", you have to use something like: Run(@Comspec & " /k DIR")

^_^

Oops, forgot the demo:

#include <IE.au3>

$sURL = "http://www.google.com"
$oIE1 = _IECreate($sURL)
$oIE2 = _IECreate($sURL)
Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

No, it doesn't. Can you post a reproducer that will show that happening? Demo script below opens two different instances every time.

ShellExecute() can be used with non-executables, like a URL or folder path. The shell will determine what to run based on file extention, etc., just like if typed in the Start|Run dialog. Run() requires an actual executable, which is why if you want to run a CMD.exe embedded command like "DIR", you have to use something like: Run(@Comspec & " /k DIR")

:)

Oops, forgot the demo:

#include <IE.au3>

$sURL = "http://www.google.com"
$oIE1 = _IECreate($sURL)
$oIE2 = _IECreate($sURL)

Hi - I tried your demo. My script calls the URL in exactly the same way.

Although each of these is showing up on the Task Manager 'Applications' tab, only a single IEXPLORE process is showing up on the Task Manager 'Processes' tab (see attached jpg).

post-30359-1198177132_thumb.jpg

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@all - OP is correct. If I manually open an IE the proccesses list increases. -using the script does not. (appears to behave like a tabbed browser in that it only displays one process) -yes I sorted by image name to verify count :)

someone else will come along and post something that makes this comment look foolish but as a last resort.

run a shortcut that points to IE and just attach to it to gain control . . .

Edited by Hatcheda

Share this post


Link to post
Share on other sites

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

The COM automation interface gives no facility to do this. In the past, I have recommended a workaround like this:

#include <IE.au3>
ShellExecute("iexplore.exe", "about:blank")
WinWait("Blank Page")
$oIE = _IEAttach("about:blank", "url")
_IELoadWait($oIE)
_IENavigate($oIE, "www.autoitscript.com")

Dale

@Neven - there are cases where getting multiple iexplore processes is desired. For example, session cookie context is shared withing all browser instances in the same iexplore process... start a new iexplore and you get a new session cookie context.

Well... didn't know that. I'll just shut up now...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0