Robert wrote: > What is the best way to get the URL of current open webbrowser > Window (topmost) into a utility script? At least for IE & Mozilla's
I don't think that there is a straightforward answer to this question. Assuming you're starting from nothing, there are two issues here: find an open web browser; find out what page that web browser is on. Even if you limit yourself to IE & Firefox (and there are others) you still have to do the "Find a top-level window" dance. What do you do if there is more than one such open? Or if there is one of each? Once you've done that -- say, by choosing the first one you come to -- you then have to adopt multiple strategies for determining the current URL. And the first question is: What is the "current" URL for a browser with multiple tabs. I don't have one to hand, but you examples abound on the Web of finding the top-level window for an application. Modules like pywinauto [1] or WATSUP [2] can probably help you out. Once you've found the window, with IE you should be able to interrogate it via COM. Have a look at PAMIE [3] but I don't think Firefox is COM-scriptable you might have to fallback on pywinauto to interrogate windows class by class to spot the one with the URL in it. TJG [1] http://www.openqa.org/pywinauto/ [2] http://www.tizmoi.net/watsup/intro.html [3] http://pamie.sourceforge.net/ _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32