how to recognize IE window already opened using win32com extension
kyosohma at gmail.com
Mon Jul 7 18:19:15 CEST 2008
On Jul 7, 11:09 am, korean_dave <davidrey... at gmail.com> wrote:
> How do I use the win32com API to manipulate IE windows ALREADY open?
> ie = Dispatch("InternetExplorer.Application") opens a new window.
> But I'd like to be able to find, of windows already open, a specific
> window (with a specified property, matching url, etc.)
You'll probably want to re-post to the PyWin32 user's group, but in
the mean time, here's one way to go about it. I use the following
def windowEnumerationHandler(self, hwnd, resultList):
This is a handler to be passed to win32gui.EnumWindows() to
a list of (window handle, window text) tuples.
And call it like this:
topWindows = 
Then you can use a for loop to iterate over the topWindows list to
find the one with the correct title:
for i in topWindows:
if windowText in i:
# do something
Notice that I use the win32gui module. Make sure you have the win32
modules installed or this won't work.
Here's the link to PyWin32 group: http://mail.python.org/mailman/listinfo/python-win32
That should get you going...hopefully
Python Extension Building Network: http://www.pythonlibrary.org
More information about the Python-list