AutoIt exe of a third party application not running completely when run through a powershell script on windows server 2012 [duplicate]

我是研究僧i 提交于 2019-12-25 10:18:07

问题


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..


回答1:


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


来源:https://stackoverflow.com/questions/29767934/autoit-exe-of-a-third-party-application-not-running-completely-when-run-through

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!