使用python自动化外部程序 [英] Using python to automate external program

查看:75
本文介绍了使用python自动化外部程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是自动执行外部程序的最佳Python库

我们拥有会计软件,出于特定原因,我们需要在其中上传许多文件.为此,我们搜索相关的菜单项,右键单击它,然后导入.这很费时间.能够自动执行此操作将很有用.我看过pyautogui,但它需要屏幕处于活动状态,并且用户在运行时无法在其计算机上执行任何其他操作.

当然,理想情况下,我当然想使用会计软件的API(如果有的话),或者查找上载是否在后端使用文件路径作为参数在后端运行存储过程,然后自己调用该过程./p>

在没有这些语言的情况下,谁会知道是否有一种方法可以在没有上述限制的情况下在Python中实现自动化,或者如果没有在Python中可以使用哪种其他语言呢?

非常感谢

解决方案

我还没有这样做.因此,我没有概念证明.但您至少有2种选择,或多或少有些复杂:

  1. 安装virtualbox/vmware,并在其上创建虚拟操作系统(Windows或Linux).然后在此虚拟操作系统中运行pyautogui脚本.您的操作系统在类似窗口的容器中可用-因此您可以通过运行脚本最小化该窗口,并在系统上以用户身份进行交互.(完整的教程: https://www.virtualbox.org/manual/ch01.html)

  2. 如果您是Linux用户,那么您可能熟悉虚拟屏幕.我认为许多人正在使用此虚拟屏幕来自动进行Sellenium中的Web测试(如何操作我在Xvfb中运行Selenium吗?).所以大概,我说大概有机会在虚拟屏幕上运行pyautogui:如何将pyautogui附加到虚拟显示器上?-这是相似的,但未回答的问题.

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

解决方案

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.

这篇关于使用python自动化外部程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆