使用 Python 控制 Windows 应用程序 [英] Control Windows App with Python

查看:109
本文介绍了使用 Python 控制 Windows 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 python 脚本打开 Windows 应用程序,对其执行循环调用,检索值并将它们保存到文本文件中.

I am trying to open a Windows app with a python script, execute a loop of calls on it, retrieve the values and save them to a text file.

我使用 bellow python 脚本打开应用程序,我不确定接下来需要做什么,是否有我可以从应用程序获取的调用命令列表,以便我知道要调用哪个?如何从 python 导航应用程序界面?

I used the bellow python script to open the application, I am not sure what need to be done next, is there a list of calls-commands that I can get from the application so I'll know which one to call? how do I navigate the application interface from python?

import os
import subprocess

cmd = 'C:/Program Files (x86)/path/to/my/application.exe'
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

提前致谢!

推荐答案

如何从 python 导航应用程序界面?

How do I navigate the application interface from python?

这听起来像是您尝试运行的应用程序具有图形界面,您将无法为此使用 subprocess 模块.subprocess 模块应该只用于运行命令行应用程序或根本没有输出/接口的应用程序.

This sounds like the application that you are attempting to run has a graphical interface, you will not be able to use the subprocess module for this. The subprocess module should only be used to run command line applications or applications that have no output/interface at all.

查看以下问题的答案,了解如何使用 Python 与 GUI 通信:让您的程序使用贵

Check out the answers to the following question for how you might be able to communicate with a GUI using Python: Make your program USE a gui


是否有我可以从应用程序中获取的调用命令列表,以便我知道要调用哪个?

Is there a list of calls-commands that I can get from the application so I'll know which one to call?

这完全取决于应用程序,如果不知道您正在运行哪个应用程序,我们将无法提供此信息.

This depends entirely on the application, without knowing which application you are running there is no way we will be able to provide this information.

这篇关于使用 Python 控制 Windows 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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