Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Welcome to Help
I'm trying to control an app called MediaMan (http://www.imediaman.com)
Just simple connect and select a menu:
from pywinauto import application
app = application.Application()
app.connect_ ( title = "jeffMovies - MediaMan" )
This fails with:
ReBarWindow32 - (L4, T32, R594, B91) '' 'ReBar'
MediaMan ToolBarCtrlEx - (L16, T59, R590, B89) '' 'MediaMan ToolBarCtrlEx'
WTL_CommandBar - (L16, T34, R590, B53) '' 'WTL_CommandBar'
msctls_statusbar32 - Ready (L4, T417, R594, B440) 'StatusBar' 'Ready' 'ReadyStatusBar'
... <snip> ....
Traceback (most recent call last):
File "C:\WindowWatcher\pywinAuto_installer\genMovieManCSV.py", line 9, in ?
File "c:\python24\Lib\site-packages\pywinauto\controls\HwndWrapper.py", line 840, in MenuSelect
path_items = menu.GetMenuPath(path)
File "c:\python24\Lib\site-packages\pywinauto\controls\HwndWrapper.py", line 1409, in GetMenuPath
File "c:\python24\Lib\site-packages\pywinauto\findbestmatch.py", line 94, in find_best_match
raise MatchError(items = text_item_map.keys(), tofind = search_text)
MatchError: Could not find 'File' in ''
The menu bar is a draggable palette.. based on the Y coordinates I'd say that the menus are probably in the WTL_CommandBar, contained in the ReBarWindow32.
How do I select from this kind of menubar?
Mark Mc Mahon
This is exactly the same problem as there is with Internet Explorer menus (and maybe they are common enough that I need to think about making support for them easier).
For now the best way of using these menus is through the use of TypeKeys()
E.g. (if the shortcuts for Export and Collection are E and C)
# Press the alt key and then
# F for File
# E for Export
# C for Collection
If they have no short cuts and the above doesn't work then you might have to press the down key. (note I am just making up the numbers below - I don't know at what position the items are) e.g.
# open the file menu
# hilight the export item
# and open it's sub menu
# select the collection item
I hope that helps - even if it is not the nicest way in the world :-(
Thanks Mark... TypeKeys("%FEC") worked fine.
I guess that's not *so bad*, because the keys are directed to that particular app.