separate IE instances?
correiajREMOVECAPS at hotmail.com
Mon Jun 13 17:46:50 CEST 2005
<erinhouston at gmail.com> wrote in message
news:1118671935.537464.150380 at z14g2000cwz.googlegroups.com...
> 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 should be
> hwnds. 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",
> b = win32api.ShellExecute(0,None,"iexplore.exe",
> hwnds = Dispatch(internetExplorerClassIdentity)
> # way I showed you before dosn't work verry well if more then one ie is
> #ieObj = hwnds
> 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]
The thing to note is that hwnds brings back a list of all Internet Explorer
objects running on your machine. This *includes* things that might
not be obvious at first, like a simple Windows Explorer window
(or windows) you have running (since it uses IE in the background).
Printing hwnds.LocationName and hwnds.LocationURL in a loop
will show you exactly what processes are using IE at the time you run it.
Given that the returned list will vary each time you run your program
you'll definitely have to iterate through each hwnds item and check
if it is the browser session you want as shown in the above code.
More information about the Python-list