Python Forum
How to automate the clicking of GUI's menu? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to automate the clicking of GUI's menu? (/thread-19581.html)



How to automate the clicking of GUI's menu? - Hypermesher - Jul-05-2019

Hello,

I have a question about GUI libraries. I am working on an automation program. I use coordinate info of a command (for example, file -> open or about -> help) via pyautogui. However, according to screen resolution or program window location, this command’s coordinate can be changed. To fix this problem, I want to move without coordinate. How can I select a command of a program via GUI libraries? Is it possible to make this? Because I know, pywinauto has a special movement for Notepad (app.Notepad.menu_select(“File->SaveAs”). I wonder, can I use this for other programs?


RE: How to select a command of a program via GUI libraries? - Denni - Jul-05-2019

Okay please clarify your question a bit more -- as far as I know if you presenting something on a screen you have to use coordinates as that is the only way to communicate to the hardware where to place what it is you want drawn on the display device and yes the coordinate system adjusts to the display mechanism(s) as this is what it has to do to render things properly.

Now if you are talking about something else then perhaps you can as the only time you need coordinates are when you are working to display something upon a display device. Your mentioning of coordinates in conjunction with function calls has me a bit confuzzled as these are not synonymous concepts


RE: How to select a command of a program via GUI libraries? - Yoriz - Jul-05-2019

Yes pywinauto can access the menu directly with other programs than notepad.
In the code app.Notepad.menu_select(“File->SaveAs”) Notepad is not hard coded, it looks for a window with the title Notepad.

pywinauto entry points for automation


RE: How to automate the clicking of GUI's menu? - Malt - Jul-26-2019

Yes, we can work on the menu items directly. Just we have to get the properties of the window/dialog elements and use them directly in your cide