AutoIt 脚本无缘无故挂起

AutoIt 脚本无缘无故挂起

我被这个脚本困住了。很长时间它都不起作用。然后突然它起作用了...现在...重新安装时...它又不起作用了。它在第一行 winwaitactive 上停止。文件夹肯定是正确的。

    #include <File.au3>
    #include <Array.au3>

    AutoItSetOption ("WinTitleMatchMode", 1)
    AutoItSetOption ("WinTextMatchMode", 2)
    AutoItSetOption ("TrayIconDebug", 1)

    $folder = "F:\MUSIC SOFTWARE\BIAB\TRACKS\REALTRACKS\"

    Local $files = _FileListToArray($folder, "*")

    For $i = 1 to UBound($files)
        install($files[$i])
    Next

    Func install($file)
       $pid = Run($file)
       WinWaitActive("Setup - RealTracks", "Welcome to the RealTracks")
       Send("!n")
       WinWait("Setup - RealTracks", "Please read")
       Send("!a")
       Send("!n")
       WinWait("Setup - RealTracks", "When you are ready")
       Send("!n")
       WinWait("Setup - RealTracks", "Where should")
       Send("!n")
       WinWait("Setup - RealTracks", "Setup is now ready")
       Send("!i")
       WinWait("Setup - RealTracks", "Completing")
       Send("!f")
       ProcessWaitClose($pid)
    EndFunc

答案1

查看脚本,没有对$File变量进行声明。另外,您正在使用wintitlematchmode, 2,因此您不需要在窗口符号中如此明确。而不是Setup - RealTracks尝试RealTracks

相关内容