Hello James. Thank you for your advice. I ran Spy++. At the logging options I selected the menu bar portion of the other program. I selected WM_COMMAND only and then chose all "Additional Windows" (except for the All Windows in System). Then I clicked one of the menu items I wanted: Edit | Select All. It provided me with the following line: WM_COMMAND wNotifyCode:0 (sent from a menu) wID:57642. How can I use this class ID (57642) in Python to act as if it was clicked/pressed?
E m r e On Saturday, September 29, 2018, 1:55:37 AM GMT+3, James Scholes <ja...@jls-radio.com> wrote: Emre CETIN via python-win32 wrote: > from there is was a matter of controlling the keyboard with the > SendKeys() command. This seems pretty fragile at best. If the menu bar is a standard Windows control, the window will respond to WM_COMMAND messages and carry out the appropriate menu command without you having to send keyboard keys. You'll need to use a tool like Spy++ to log the window messages while you manually activate the menu commands, in order to determine the correct IDs for the items you need. > > *E m r e* > > > On Tuesday, September 25, 2018, 5:40:49 PM GMT+3, Emre CETIN via > python-win32 <python-win32@python.org> wrote: > > > Hello Simon. Thank you for your response. I had read of pywinauto but > hadn't used it before. After your advise i have been working on it for > hours. But unfortunately i can not get the menu items. I analyzed it via > a tool named Swapy and it shows the MenuItems field [] as an empty list. > I'm still stuck :/ > > *E m r e* > > > On Tuesday, September 25, 2018, 1:33:01 AM GMT+3, Simon McConnell > <simonmcconn...@gmail.com> wrote: > > > I haven't used it myself but I believe this is what pywinauto does: > http://pywinauto.github.io > > On Tue, 25 Sep 2018 at 02:04 Emre CETIN via python-win32 > <python-win32@python.org <mailto:python-win32@python.org>> wrote: > > Hi, I am writing a script to automate a program named Golden > Software Surfer. I am using import win32com.client in Python during > this process. At one point though i can not get past a certain step > of my code. The reason is because Surfer's automation utility > (Scipter) does not allow that part to be controlled. I could get > past this step if i could control the main program's (Surfer) Menu > bar. This step just has a couple of processes that all are within > the Menu bar itself. For example here is what I want to automate: > ****** > 1) Arrange | Edit Group > 2) Edit | Select All > 3) Geoprocessing | Change Boundaries | Polyline to Polygon > 4) Geoprocessing | edit Boundaries | Combine Islands / Lakes > 5) Arrange | Stop Editting Group > ****** > All of these steps aren't changeable via its scripting libraries > within Scripter. But they are all under the main programs Menu Bar. > Is there a way for me to automate the menubar via win32com? If so > could you please help me understand how? > > Basically i am trying to learn how to control the menu bar of Surfer > from Python. > > Thank you all in advance. > > _______________________________________________ > python-win32 mailing list > python-win32@python.org <mailto:python-win32@python.org> > https://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ > python-win32 mailing list > python-win32@python.org <mailto:python-win32@python.org> > https://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > https://mail.python.org/mailman/listinfo/python-win32 > Regards, James Scholes https://twitter.com/JamesScholes
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32