Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $MakeAVIS_Path = "C:\Program Files (x86)\ffdshow\makeAVIS.exe";
- $MakeAVIS_Timeout = 3 # seconds
- #----------------------------------------------------------------------
- function Select-Folder($Message = 0, $Path = 0)
- {
- $FolderSelectionDlg = New-Object -comObject Shell.Application
- $Folder = $FolderSelectionDlg.BrowseForFolder(0, $Message, 0, $Path)
- if($Folder -ne $null)
- {
- $Folder.self.Path
- }
- }
- #----------------------------------------------------------------------
- # Main script body
- # check provided makeAVIS path
- $FileExists = Test-Path $MakeAVIS_Path
- if($FileExists -eq $False)
- {
- [Console]::WriteLine("Путь к makeAVIS указан неверно (""" + $MakeAVIS_Path + """).");
- exit;
- }
- # rise folder selection dialogs for source and output folders
- $ScriptsFolderPath = Select-Folder("Выберите папку с avisynth скриптами");
- if($ScriptsFolderPath -eq $null)
- {
- exit;
- }
- $OutputFolderPath = Select-Folder("Выберите папку для avi-пустышек");
- if($OutputFolderPath -eq $null)
- {
- exit;
- }
- [Console]::WriteLine("Обрабатываем avisynth скрипты в """ + $ScriptsFolderPath + """");
- $FileEntries = [IO.Directory]::GetFiles($ScriptsFolderPath);
- $FilesCount = 0;
- foreach($FilePath in $FileEntries)
- {
- if($FilePath.ToLower().EndsWith(".avs"))
- {
- $iFileNameStart = $FilePath.LastIndexOf("\");
- $OutputFilePath = $OutputFolderPath + $FilePath.Substring($iFileNameStart, $FilePath.Length - 4 - $iFileNameStart) + ".avi";
- # command line arguments for makeAVIS
- # input script output video store input script in .avi dummy
- # -i "C:\\Temp\TestVideo.avs" -v "C:\\Output\TestVideo.avi" -s 1
- $makeAVIS_Args = " -i """ + $FilePath + """ -v """ + $OutputFilePath + """ -s 1";
- [Console]::WriteLine($FilePath.Substring($iFileNameStart + 1, $FilePath.Length - 1 - $iFileNameStart));
- $MakeAVIS_Process = Start-Process -FilePath $MakeAVIS_Path -ArgumentList $makeAVIS_Args -WindowStyle Hidden -PassThru
- Wait-Process -InputObject $MakeAVIS_Process -Timeout $MakeAVIS_Timeout -ErrorAction SilentlyContinue
- Stop-Process -InputObject $MakeAVIS_Process -Force
- $FilesCount = $FilesCount + 1;
- }
- }
- [Console]::WriteLine("Обработано " + $FilesCount + " файлов.");
- [Console]::WriteLine("^_^");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement