2015-11-16 25 views
0

我渲染的Adobe After Effects的項目與AutoIt的和aerender, 我就把這行代碼在控制檯:的AutoIt的Adobe aerender

aerender -project C:\aeProjects\projekt_1.aep -comp "Main" -output C:\aeProjects\output\asd.avi 

現在,我怎麼能檢查,如果這proccess做,使我可以安全地恢復其他步驟。 目前我只是睡覺,但這不是我認爲的一個好習慣。

回答

0

您可以使用ProcessExists函數來執行此操作。

下面是一個簡單的例子,一個超時選項:

MsgBox(64, "RunCmdWait", RunCmdWait("notepad.exe")) 

Func RunCmdWait($sRuncmd, $iTimeout = 10000) 
    Local $iPid = Run(@ComSpec & " /c " & $sRuncmd, @ScriptDir, @SW_HIDE, 6) 
    Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable. 

    While 1 
     Sleep(250) 
     ;Returns 0 when the process is closed 
     If ProcessExists($iPid) = 0 Then 
      SetError(0) 
      ExitLoop 
     EndIf 

     ;Returns 1 on time out error 
     If TimerDiff($hTimer) >= $iTimeout Then 
      SetError(1) 
      ExitLoop 
     EndIf 
    WEnd 

    Return @error 
EndFunc ;==>RunCmdWait 

這裏是一個StdoutRead例如,如果你需要閱讀的輸出:

MsgBox(64, "StdoutRead", GetStdoutRead("dir")) 

Func GetStdoutRead($sRuncmd) 
    Local $iPid = Run(@ComSpec & " /c " & $sRuncmd, @ScriptDir, @SW_HIDE, 6) 
    Local $sStdoutRead = "" 
    While ProcessExists($iPid) 
     $sStdoutRead &= StdoutRead($iPid) 
    WEnd 

    Return $sStdoutRead 
EndFunc ;==>GetStdoutRead