Reputation: 465
I'm automating the following program via Python: (Surfer)
http://www.goldensoftware.com/products/surfer
Some portions of it i cannot control using win32com.client (the program libraries do not support it). The part i need to get working can be done by using the programs menu bar. It's just 5 clicks i need to get done. So as an alternative i have been trying to use pywinauto (my first try with this). But this time i can not get the menu bar items. I tried analyzing the menus via swapy (https://github.com/pywinauto/SWAPY) but the MenuItems field show up empty (as an empty list []).
here is some test code:
from pywinauto.application import Application
app = Application(backend="uia").connect(process=2984) # tried "win32" as backend also
srf = app.window(process=2984)
srf.menu_select("Help")
I get the error:
"RuntimeError: There is no menu."
The menus I am trying to access are within:
Any help will be appreciated.
Upvotes: 2
Views: 2717
Reputation: 465
I finally was able to get the menu controlled via pywinauto:
app_dialog.child_window(title="Menu Bar").set_focus()
From there is was a matter of controlling the keyboard with the SendKeys() module.
It's a workaround but it gets the job done.
Upvotes: 1