Using python to automate external program

早过忘川 提交于 2021-02-11 15:24:57

问题


Whats the best Python library to automate an external program

We have accounting software where we need to upload many files into for a particular reason. To do this we search for the relevant menu item right click it and then import. This is time consuming. It would be useful to be able to automate this. Ive looked at pyautogui but it needs the screen to be active and the user cant do anything else on their machine while it is running.

Of course ideally I would like to use the accounting software's API (if there is one) or find out if the upload is running a stored procedure at the back end taking the filepath as a parameter and then calling this procedure myself.

In the absence of those would anyone know if there is a way to automate this in Python without the limitations above or if not in Python what other language would be good for this?

Many thanks


回答1:


I haven't done such thing. So I do not have proof of concept. But You have at least 2 options, more or less complicated:

  1. install virtualbox/vmware, and create virtual operating system (windows or Linux) on it. Then run your pyautogui script in this virtual operating system. You operating system is available in window-like container - so you can minimize this window with running script, and you system where you can interact as a user. (long tutorial: https://www.virtualbox.org/manual/ch01.html)

  2. If you are Linux user, then you may be familiar with virtual screen. I think many people are using this virtual screen with automating web testing in sellenium (How do I run Selenium in Xvfb?). So probably, I say probably, there is chance to run pyautogui in virtual screen: How to attach pyautogui to the virtual display? - this is similar, but not answered question.



来源:https://stackoverflow.com/questions/58184328/using-python-to-automate-external-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!