从 Windows 服务中编写 GUI 脚本?
我想自动化一个仅作为 GUI 应用程序附带的 Windows 应用程序(不支持命令行)。 AutoIt 的自动化本身相对简单。
然而,我想知道,是否可以通过 Windows 服务启动 Windows 应用程序(只需调用 AutoIt 脚本)?
I would like to automate a windows app that comes only with as a GUI app (no support for command-line). The automation itself is relatively straightforward with AutoIt.
Yet, I am wondering, is-it possible to launch the Windows App from with a windows service (that would simply call the AutoIt script)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
即使 Auto-it 可以与 UAC 一起使用,您也很可能会遇到会话隔离问题 - 即服务和桌面不会混合并向彼此发送消息,除非明确编码以通过它。
所以这是可能的,但也不是小菜一碟。
您可能想查看: 启动 .从服务交互地使用 Net winforms 应用程序
Even if Auto-it can work with UAC, you will most likely run into Session Isolation troubles - i.e services and desktop don't mix and send messages to each other, unless explicitely coded to pass through it.
So it's possible, but it's not a piece of cake either.
You probably want to look at : Launching a .Net winforms application interactively from a service
虽然由于最新版本的 Windows 中与会话 0 隔离相关的复杂性而完全不建议这样做,但 AutoIt 脚本当然可以从 Windows 服务调用。 请参阅此页面,了解一些从 Windows 服务调用时按预期工作的示例脚本。
但不幸的是,并非所有 AutoIt 函数似乎都能在会话 0 中工作。我们在“Win*”例程(WinActivate、WinExists)方面遇到了麻烦,因此您应该尽可能避免使用这些例程。 由于文档没有突出显示有问题的功能,因此请务必彻底测试!
While not at all advised because of complications associated with Session 0 isolation in the latest versions of Windows, AutoIt scripts can certainly be invoked from a Windows Service. Please see this page for a few sample scripts that work as expected when called from a Windows Service.
Unfortunately though, not all of the AutoIt functions seem to work in Session 0. We ran into trouble with the "Win*" routines (WinActivate, WinExists) so you should probably avoid those if you can. And since the documentation does not highlight the problematic functions be sure test thoroughly!