473,508 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FOUND! how to attach to running instances of Internet Explorer

Most folks know you can start up an instance of Internet Explorer by
saying "x=win32com.client.Dispatch('InternetExplorer.Appl ication.1')"
and you get a WIN32 object with a "Document" object that has arrays of
"Link"/"Form"/"Frame" subobjects, and methods like "Navigate" where
you can force the IE instance to browse to a new URL.

What folks would like to do is to connect to an already running
version of explorer, and this isn't so obvious.

The MS KB article you usually find is 176792 which mentions using
SHDocVw.ShellWindows to iterate through the instances. However Mark
Hammond sayes this is a "vtable interface" (whatever that is) and "not
supported by python" in
http://groups.google.com/groups?hl=e...pretection.com

HA! well, I happened to discover you can do:

import win32com.client
# look in the makepy output for IE for the "CLSIDToClassMap"
# dictionary, and find the entry for "ShellWindows"
clsid='{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'
ShellWindows=win32com.client.Dispatch(clsid)
for i in range(ShellWindows.Count):
print i
# this is the titlebar value
print ShellWindows[i].LocationName
# this is the current URL
print ShellWindows[i].LocationURL
print

and the object returned by ShellWindows[n] is the exact same as the
one returned by Dispatch('InternetExplorer.Application.1')

I'm posting this here for future generations of Googlers.

So I'm running Win2K Pro... and I'm curious about what versions this
works under. I'm pretty sure you have to have IE 5.0 or newer, but
could folks try this code on 95/98 and tell me (gcash-at-cfl.rr.com)
if it works??

Also, I haven't been able to determine if there's a better name of the
form 'InternetExplorer.Application.1' instead of using the horrid
class-id. How do you do that? The makepy output for explorer doesn't
list one.

Thanks to Mark Hammond for win32all, it is a true work of art, and is
teaching an old UNIX hack lots of Windows stuff.

-gc

--
I've never tried emacs because I already _have_ an OS on this peecee.
-- mi***@mikea.ath.cx (Mike Andrews)
Jul 18 '05 #1
3 9418
gcash ....

Your win32 script for connecting to open IE instances
works fine for me using ....

Win98_SE
Python 2.2.1

Displays info for open IE instances
for both local and remote pages ....

--
Cousin Stanley
Human Being
Phoenix, Arizona
Jul 18 '05 #2
"Cousin Stanley" <Co***********@hotmail.com> writes:
Your win32 script for connecting to open IE instances
works fine for me using ....

Win98_SE
Python 2.2.1


Awesome! That gives me hope it isn't some one-off WIN2K thing.
Cool! Thanks.

-gc

--
I've never tried emacs because I already _have_ an OS on this peecee.
-- mi***@mikea.ath.cx (Mike Andrews)
Jul 18 '05 #3
> Also, I haven't been able to determine if there's a better name of the
form 'InternetExplorer.Application.1' instead of using the horrid
class-id. How do you do that? The makepy output for explorer doesn't
list one.


The relevant MSDN page[1] lists the ProgID as 'Shell.Windows' or
'ShellWindows._NewEnum'; however when trying to dispatch with either as the
class string fails. Also, searching the registry reveals nothing for the
CLSID.

[1] http://tinyurl.com/ix1z , i.e.
http://msdn.microsoft.com/library/de.../objectmap.asp

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2339
by: Randy Jackson | last post by:
Hello everyone. First of all, apologies in advance if this is a question that gets asked all the time. I tried to search, but wasn't really sure exactly what to search for. Anyway, here's...
1
6442
by: bjwang | last post by:
Hello wisers, We are testing a system which is developed on top of Oracle 9iAS. The client PCs are using Internet Explorer to access the system. We are sure that the Oracle 9i database server is...
12
19559
by: SunshineGirl | last post by:
I'm trying to receive events from a running instance of Internet Explorer. So far I've only been able to receive events from an instance I launch from code, but I need to receive events from all...
0
1365
by: Florin M | last post by:
I am running a custom application developed with ASP.NET 1.1, C# and Visual Studio 2003. I recently installed SP2 for XP Professional. When I close the Internet Explorer window where the app...
6
3289
by: Thomas | last post by:
Hi, I'm having a problem with the dynamically created inputfields in Internet Explorer. The situation is the following: - I have a dynamically created table with a textbox in each Cell. - It...
11
1998
by: GHUM | last post by:
Hello, I created some rather complex Intranet Application, using lots of JavaScript, DOM-Maninpulation and XMLHTTPRequest communication. I developed on FireFox, with the excellent firebug ......
4
2555
by: redoix | last post by:
Sometimes There To Many Instance Of The Internet Browsing Page Running On The Taskbar. This Slows Down Connection.how Do I Limit The Instances Of Internet Browsers So That One The Limit Is Reached...
26
2237
by: Prisoner at War | last post by:
Hi, All: I have a JavaScript search engine that always causes MSIE 7 to do a top-of-page security "warning" (that top-of-page-bar, and not an "alert" )...but other websites' JavaScripts do not...
0
1482
by: Bill Corry | last post by:
I have been trying to get an instance of internet explorer to navigate to a website using the Navigate2 command. When the navigation request uses the Get method (just a URL) there is no problem. ...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.