在 Windows Server 2012 上通过 powershell 脚本运行时,第三方应用程序的 AutoIt exe 未完全运行 [英] AutoIt exe of a third party application not running completely when run through a powershell script on windows server 2012

查看:41
本文介绍了在 Windows Server 2012 上通过 powershell 脚本运行时,第三方应用程序的 AutoIt exe 未完全运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 autoit 脚本语言进行自动化.我创建了一个 autoit 脚本的可执行文件,以便我可以在任何地方运行它.我已将可执行文件上传到不同的服务器.然后我编写了一个 windows powershell 脚本,它从该服务器下载 autoit exe 并在 windows server 2012 上运行它.当我在 windows server 2012 上手动运行 powershell 脚本时,它运行没有问题并完成 autoit 脚本.但是,当我将 powershell 脚本放入自动执行的应用程序中时,autoit exe 会成功下载,但无法完全运行.它卡在该第三方应用程序的最后 2 个窗口中.以下是我在每个窗口上用于自动化的脚本示例:

I am using autoit scripting language for automation. I have created an executable of autoit script so that I can run it anywhere. I have uploaded the executable to a different server. I then wrote a windows powershell script which downloads the autoit exe from that server and runs it on windows server 2012. When I run the powershell script manually on windows server 2012, it runs without issues and completes the autoit script. But when I put a powershell script in an application which automatically executes that, the autoit exe gets downloaded successfully but it does not run completely. It gets stuck at the last 2 windows of that third party application. Following is the sample of a script that I have used for automation on each window:

_FileWriteLog($hFile, "Reboot Window")  
$hWnd = WinWait("Install","This system must be ")                         
_FileWriteLog($hFile, $hWnd)  
ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:3]")              

任何帮助将不胜感激.. !!谢谢..

Any help would be appreciated .. !! Thanks..

推荐答案

在操作外部应用程序窗口时,始终使用 #RequireAdmin 以获得权​​限提升.也可以使用 Opt("WinSearchChildren", 1) 来搜索子窗口.玩WinTitleMatchMode"

When manipulating external application windows, always use #RequireAdmin in order to get the permission elevation. Also use Opt("WinSearchChildren", 1) in order to search child windows too. Play with "WinTitleMatchMode"

#RequireAdmin ;Will give your script a permission elevation (sometimes its needed)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinSearchChildren", 1) ;0=no, 1=search children also

这篇关于在 Windows Server 2012 上通过 powershell 脚本运行时,第三方应用程序的 AutoIt exe 未完全运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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