问题描述
我正在使用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无法完全运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!