python - Is it possible to interact with GUI-based desktop applications using Python, and how?
问题描述
I plan to write a service for my *nix systems that can interact with a select number of GUI applications like Photoshop, Libre Office, etc. on the local machine.
The purpose for the local service is essentially to listen to a remote message and accordingly perform specific operations- for instance, changing the background of a layer in Photoshop, or adding margins to a page in Libre Office (or MS Office). You can assume that the application is active in the display environment of the operating system.
Now my question is:
- Is this even possible? I personally find this task impossible unless I get to peek into the source code of these apps and basically augment these applications themselves. But since they are mostly proprietary apps, there are legal implications too.
- Assuming it is somehow possible by changing the source of these apps, won't a team have to figure out the architecture and the inner workings of all these specifi applications or are there general frameworks concepts I should look into?
解决方案
UI 应该只从主线程更新。或者只是考虑发送 Windows 消息。
本地服务的目的本质上是侦听远程消息并相应地执行特定操作
Microsoft 目前不推荐也不支持任何无人值守、非交互式客户端应用程序或组件(包括 ASP、ASP.NET、DCOM 和 NT 服务)的 Microsoft Office 应用程序自动化,因为 Office 可能表现出不稳定的行为和/或在此环境中运行 Office 时出现死锁。
如果您正在构建在服务器端上下文中运行的解决方案,您应该尝试使用已确保无人值守执行安全的组件。或者,您应该尝试找到允许至少部分代码在客户端运行的替代方案。如果您使用来自服务器端解决方案的 Office 应用程序,该应用程序将缺少许多成功运行所需的功能。此外,您将承担整体解决方案稳定性的风险。在Office 服务器端自动化的注意事项文章中阅读有关此内容的更多信息。
推荐阅读
- r - 读取多个excel文件,添加一列,然后绑定
- sql-server - 如何从字符串(SQL 服务器)中剪切一个数字(正数或负数或浮点数)?
- linux - 如何将 GNOME gnotes 同步到 Google Keep
- java - 如何使用第二种主要方法在 Spring Boot 中加载 ApplicationContext?
- gradle - 为什么 gradle 会忽略我的最大堆大小并使用默认值 512MB?
- excel - Tableau 中每月回报流的相关矩阵
- aframe - 我们可以通过 a-scene 属性设置 renderer.toneMapping 吗?
- ruby - 为什么不能从 YAML 中反序列化所有 DateTime 实例?
- amazon-web-services - 使用来自另一个区域的 AWS Private Api Gateway
- import - 如何从 TIFF 文件中的文本包围的具体行中获取数字(如果在记事本中查看)并将其用于 Digital Micrograph 的脚本中?