Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateObject() problem 1

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
Is it possible, if so, how to pass in command line arguments to CreateObject

For instance, with Internet Explorer, there are switches like -new to get IE to start with as a new instance and session. How could I modify the following code to do just that


Dim objIE
objIE = CreateObject("InternetExplorer.Application");

What I want to do is use VBScript to create a new IE window with a NEW session, without destroying the existing window and session.
 
Does this example helps ?
Code:
Set oIE = CreateObject("InternetExplorer.Application")
oIE.left      = 300
oIE.top       = 50
oIE.width     = 424
oIE.height    = 250
oIE.menubar   = false
oIE.toolbar   = false
oIE.statusbar = false
oIE.Resizable = False
oIE.navigate("[URL unfurl="true"]http://www.tek-tips.com")[/URL]
oIE.Visible = false
while oIE.Busy: Wend  ' wait for page to load...

using the "navigate" methods opens a new session, No ? Water is not bad as long as it stays out human body ;-)
 
When the script is invoked the second time, it still uses the same SESSION as the window opened when the script is invoked for the first time.
 
Another window (another IE instance) but the same session ??? Water is not bad as long as it stays out human body ;-)
 
that's right, new window, same session. It's like pressing Crtl-N from IE or doing a window.open in JavaScript.

The only way to kick off IE with new session is If you start IE from desktop, start menu, launch bar or doing iexplore.exe -new

I even modified the registry key for InternetExplorer.Application to add the -new switch to it, but sitll using the same session!.
 
What about trying a vbs with this line in it ?
Code:
WshSHell.run "iexplore.EXE " & myurl , 1 , false
Water is not bad as long as it stays out human body ;-)
 
But I don't want the menubar, toolbar, addressbar, status bar, etc. either!

Seems like I could either
1) Get new session with menu bar, etc. which I don't want
2) Get window with no menu bar but with existing session!!
 
Another idea and if it doesn't work, a question :
idea
If you lauch ie by the createObject method of my first post but calling in navigate method a page to another url and then, in this page, you redirect to the real url you want, is the problem still here (I was wondering if passing through another domain or http server should clear session).

question
Let's try to take the problem by another way : why do you absolutly want a new session ? Water is not bad as long as it stays out human body ;-)
 
how about if you do this

'First Session
Set oIE1 = CreateObject("InternetExplorer.Application")
oIE1.left = 300
oIE1.top = 50
oIE1.width = 424
oIE1.height = 250
oIE1.menubar = false
oIE1.toolbar = false
oIE1.statusbar = false
oIE1.Resizable = False
oIE1.navigate("oIE1.Visible = false
while oIE1.Busy: Wend ' wait for page to load...

'Second Session
Set oIE2 = CreateObject("InternetExplorer.Application")
oIE2.left = 300
oIE2.top = 50
oIE2.width = 424
oIE2.height = 250
oIE2.menubar = false
oIE2.toolbar = false
oIE2.statusbar = false
oIE2.Resizable = False
oIE2.navigate("oIE2.Visible = false
while oIE2.Busy: Wend ' wait for page to load...


Just a thought. ~~~~~~~~~~
LaTeR dAyS
wyattmc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top