473,666 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to recognize IE window already opened using win32com extension

How do I use the win32com API to manipulate IE windows ALREADY open?

ie = Dispatch("Inter netExplorer.App lication") 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.)
Jul 7 '08 #1
3 3107
korean_dave wrote:
How do I use the win32com API to manipulate IE windows ALREADY open?

ie = Dispatch("Inter netExplorer.App lication") 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.)
I have this strange feeling of deja vu. Is there some sort of
"opening IE windows with Python" conference going on
somewhere?

Have a look at Roger Upole's answer from the other day:

http://mail.python.org/pipermail/pyt...ne/007796.html

TJG
Jul 7 '08 #2
On Jul 7, 11:09*am, korean_dave <davidrey...@gm ail.comwrote:
How do I use the win32com API to manipulate IE windows ALREADY open?

ie = Dispatch("Inter netExplorer.App lication") 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
function:

<code>
def windowEnumerati onHandler(self, hwnd, resultList):
'''
This is a handler to be passed to win32gui.EnumWi ndows() to
generate
a list of (window handle, window text) tuples.
'''

resultList.appe nd((hwnd, win32gui.GetWin dowText(hwnd)))
</code>

And call it like this:

<code>
topWindows = []
win32gui.EnumWi ndows(self.wind owEnumerationHa ndler, topWindows)
</code>

Then you can use a for loop to iterate over the topWindows list to
find the one with the correct title:

<code>
for i in topWindows:
if windowText in i[1]:
# do something
</code>

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...hopeful ly

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
Jul 7 '08 #3
On Jul 7, 11:16*am, Tim Golden <m...@timgolden .me.ukwrote:
korean_dave wrote:
How do I use the win32com API to manipulate IE windows ALREADY open?
ie = Dispatch("Inter netExplorer.App lication") 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.)

I have this strange feeling of deja vu. Is there some sort of
"opening IE windows with Python" conference going on
somewhere?

Have a look at Roger Upole's answer from the other day:

http://mail.python.org/pipermail/pyt...ne/007796.html

TJG
Crumb! That's way easier than the one I mentioned!

Mike
Jul 7 '08 #4

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

Similar topics

1
4245
by: Fadly Tabrani | last post by:
Hi guys, This is the first time I'm posting to the newsgroup, hope you can help out. I'm writing a module to interface with the task scheduler in windows using PyWin32. Everything has been great so far but I'm stuck on displaying the propertys page of a task. Here's the code: import pythoncom import win32api
3
2024
by: datactrl | last post by:
Hi, all Is that possible I can assign an window object variable to an already opened window? With window.open(), we can get a window object from opened window. If a window has already opened, is there any way I can attach that window with an object variable in javascript? Because I want to communicate with that window. Thank you in advance! Jack
31
2838
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page www.any.xy an setting the focus to "extern". But when I go return to "main" without closing "extern", a click to an other link (e.g. www.2nd_any.xy) on "main" does not setting the focus to "extern".
14
37144
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a new blank window.. // (NOT in a pop-up, a regular new window..) can you do this?? thank you..
14
11074
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
8
2283
by: pacs34 | last post by:
I just read some stuff about XHTML 2.0 and it sounds fascinating so I have been trying to create a small test doc which has a few graphics files but whenever I submit it to the W3 validator I get this foolishness about mime type="text/html" and then it tries to validate it using SGML (in liew of XHTML 2.0) rules. Obviously this all fails. Is there anything I can do? = = = = = = = Here's my doc: = = = = = = =
4
3595
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park alpha 2) only brings it to the top if the window is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this
0
1328
by: Math | last post by:
Hello python people, Can you help me out please. I get the folllowing Error while trying to build a installer with the Distutils module: ------------------------------------------------------------------------------------------------------------------------------------------ building 'win32com.client' extension.... 'Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler,...
7
3660
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses pageA.html 2. User clicks on menu link to open popup.html 3. pageA.html checks if popup.html is already open. It is not, open
0
8445
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7386
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
2771
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 we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.