2015-11-16 2 views
0

Je suis rendu un Adobe After Effects projet avec Autoit et aerender, je mets cette ligne de code dans la console:Autoit Adobe aerender

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

Maintenant, comment puis-je vérifier si ce proccess est fait, de sorte que Je peux reprendre d'autres étapes en toute sécurité. En ce moment je viens de dormir, mais ce n'est pas une bonne pratique je pense.

Répondre

0

Vous pouvez utiliser la fonction ProcessExists pour ce faire.

Voici un exemple simple avec une option de délai d'attente:

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 

Voici un exemple avec StdoutRead si vous avez besoin de lire la sortie:

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