Thread: [Pywinauto-users] Getting Visible Windows
Status: Alpha
Brought to you by:
mcmahon_m
From: Sajid <sa...@ts...> - 2011-11-16 14:40:36
|
Hello, Not sure if anyone's out there... I've just found pywinauto while looking for a way to find all visible windows from python. Is pywinauto capable of doing this? If so, can you give me a head start? Thank you, Rick |
From: Garland, K. R <gar...@gm...> - 2011-11-16 20:20:16
|
It's been a long time since I've done much work with windows management but here is part of a script that I used to gather window information on open processes: import win32gui def get_all_windows(): """Returns dict with window desc and hwnd, don't ask me how it works!""" def _MyCallback( hwnd, extra ): """Helper function for above??""" hwnds, classes = extra hwnds.append(hwnd) classes[win32gui.GetClassName(hwnd)] = hwnd windows = [] classes = {} win32gui.EnumWindows(_MyCallback, (windows, classes)) return classes There may be a way to do this with pywinauto, but I don't have any scripts that use it in that way. I'd imagine something like this would get you started, but I don't have a way to test it at the moment. from pywinauto.application import Application from pywinauto import findwindows app = Application() # get a list of our open windows as processes dlg_list= findwindows.find_windows(title_re = ".*", top_level_only = False) # connect to a dialog using it's process id dlg = app.connect_(process = dlg_list[0]) # get some information about the process we are connected to app.dlg.control app.dlg.print_control_identifiers() On Wed, Nov 16, 2011 at 9:24 AM, Sajid <sa...@ts...> wrote: > Hello, > > Not sure if anyone's out there... I've just found pywinauto while looking > for a way to find all visible windows from python. Is pywinauto capable of > doing this? If so, can you give me a head start? > > Thank you, > Rick > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Pywinauto-users mailing list > Pyw...@li... > https://lists.sourceforge.net/lists/listinfo/pywinauto-users > > -- - Ken |