问题
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