如果Adobe Media Encoder完成将监视文件夹从.avi转换为.mp4,是否可以检入Autoit?
我寻找了一个进程,但找不到可以检查进程是否存在的东西。
发布于 2015-11-26 00:45:02
您可以使用以下代码等待文件创建完成:
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
WaitForAdobeMediaFile(@ScriptDir & "\mp4YouAreLookingFor.mp4")
If @error Then
MsgBox(262160, "Error", "FileExists timeout error.")
Else
MsgBox(262208, "", "Adobe Media is done making the file.")
EndIf
Func WaitForAdobeMediaFile($sFilePath, $iFileExistsTimeout = 10000, $iWaitForNoMoreChanges = 5000)
Local $hTimer, $sFileLastModified
$hTimer = TimerInit()
;wait for timeout or for the file exist
While 1
;if file is found
If FileExists($sFilePath) Then ExitLoop
;if the timeout is hit
If TimerDiff($hTimer) >= $iFileExistsTimeout Then Return SetError(1)
WEnd
$hTimer = TimerInit()
;gets the date and time that the file was last modified
$sFileLastModified = FileGetTime($sFilePath, $FT_MODIFIED, 1)
While 1
;reset the last time the file was modified if there was a change
If $sFileLastModified <> FileGetTime($sFilePath, $FT_MODIFIED, 1) Then
$hTimer = TimerInit()
$sFileLastModified = FileGetTime($sFilePath, $FT_MODIFIED, 1)
Else
;if the file has not been modified for the set amount of time
If TimerDiff($hTimer) >= $iWaitForNoMoreChanges Then ExitLoop
EndIf
WEnd
EndFunc ;==>WaitForAdobeMediaFile您可以像这样更改默认超时参数(它们是以毫秒为单位设置的)。
WaitForAdobeMediaFile(@ScriptDir & "\mp4YouAreLookingFor.mp4", 30000, 50000)https://stackoverflow.com/questions/33920715
复制相似问题