separate IE instances?

erinhouston at gmail.com erinhouston at gmail.com
Mon Jun 13 10:12:15 EDT 2005


Sorry about that I had an instance of ie running in the background that
was version 0  didn't see the problem tell this morining when my
computer started to not work.  it should be hwnds[1] should be
hwnds[0].  I woud enumerate them like in the code below.

If you have ie as your default browser you can use a
shellExecute(0,None,"some url here", None, None, 1)
To open directley to that page.

Here is a more complete script:
import win32api, time
from win32com.client import Dispatch
a = win32api.ShellExecute(0,None,"iexplore.exe",
"www.ishpeck.net",None,1)
b = win32api.ShellExecute(0,None,"iexplore.exe",
"www.google.com",None,1)
internetExplorerClassIdentity='{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'
hwnds = Dispatch(internetExplorerClassIdentity)
# way I showed you before dosn't work verry well if more then one ie is
open
#ieObj = hwnds[0]
#ieObj.Navigate("http://www.google.com/search?hl=en&lr=&q=python")
time.sleep(30)
for i in range(hwnds.Count):
....if hwnds[i].LocationURL.lower().find("ishpeck") > -1:
........ieObj1 = hwnds[i]
....if hwnds[i].LocationURL.lower().find("google") > -1:
........ieObj2 = hwnds[i]

ieObj1.Navigate("http://www.google.com/search?hl=en&lr=&q=python")
ieObj2.Navigate("http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/ba1395566452dba6/343672a01d5b2cdc?hl=en#343672a01d5b2cdc")




More information about the Python-list mailing list