If I run:
from pywinauto.findwindows import find_windows
find_windows(best_match="affafa")
I get an exception that returns
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python27\lib\site-packages\pywinauto\findwindows.py", line 204, in find_windows
best_match, wrapped_wins)
File "c:\Python27\lib\site-packages\pywinauto\findbestmatch.py", line 497, in find_best_control_matches
raise MatchError(items = name_control_map.keys(), tofind = search_text)
pywinauto.findbestmatch.MatchError: Could not find 'affafa' in '[u'CabinetWClass', u'Inbox (1,455) - ******@gmail.com - Gmail - Google Chrome', u'Chrome_WidgetWin_1', '', u'*new 2 - Notepad++Notepad++', u'python - Where does this pywinauto exception get its list from? - Stack Overflow - Google ChromeChrome_WidgetWin_1', u'C:\\Windows\\system32\\cmd.exe - pythonConsoleWindowClass1', u'C:\\Windows\\system32\\cmd.exe - pythonConsoleWindowClass0', u'C:\\Windows\\system32\\cmd.exe - pythonConsoleWindowClass2']' # this list has been shortened for security reasons
What I want to do is,Find out where the giant list of processes is coming from and directly call that.
So far ive been messing around with
find_windows(visible_only = False)
# and some of the other options listed in findwindows.py
but all the find_windows options only return a list of numbers which from documentation, i think are process IDs...., which for some reason do NOT match up with what i have ( for example, i create a "Calculator" and its process ID is 6566, and then i run find_windows() and i cannot find the process ID in it. So that's another issue I'm having.... but i can solve this problem if i can get my giant list.
This is my first question asked on stack overflow. I hope I made you guys proud
If you want to get a list of the names for all windows, you should use the next construction.
handles = pywinauto.findwindows.find_windows()
for w_handle in handles:
wind = app.window_(handle=w_handle)
print wind.Texts()
You may filter/extend the list by the next arguments of find_windows
function: