set Args = wscript.Arguments
if Args.Count < 2 then
wscript.stderr.writeline( "? Invalid number of arguments")
wscript.quit 1
end if
' Check for flags.
VrdAllowMultiple = false
lockFile = ""
x = ""
y = ""
dimensions = false
for i = 1 to args.Count
p = args(i-1)
if left(p,3)="/l:" then lockFile = mid(p,4)
if left(p,3)="/x:" then x = mid(p,4)
if left(p,3)="/y:" then y = mid(p,4)
if p = "/m" then VrdAllowMultiple = true
next
' Check that a lock file name was given
if ( lockFile = "" ) then
wscript.stderr.writeline( "? Lock file (/l:) not given" )
wscript.quit 2
end if
' Check if x & y dimensions were given
if ( not x = "" ) then
if ( not y = "" ) then
dimensions = true
end if
end if
' Decide on output types
profileName = "Transport Stream"
if ( c = "mp4" ) then
profileName = "MP4"
end if
Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = args(0)
destFile = args(1)
'Create VideoReDo object and open the source project / file.
if (VrdAllowMultiple) then
On Error Goto 0
Set VideoReDo = WScript.CreateObject( "VideoReDo6.Application" )
else
On Error Goto 0
set VideoReDoSilent = wscript.CreateObject( "VideoReDo6.VideoReDoSilent" )
set VideoReDo = VideoReDoSilent.VRDInterface
end if
'Hard code no audio alert
VideoReDo.ProgramSetAudioAlert( false )
' Open source file
' 2nd arg has to be true for qsfix mode to apply
openFlag = VideoReDo.FileOpen(sourceFile, true)
if openFlag = false then
wscript.stderr.writeline( "? Unable to open file/project: " + sourceFile )
wscript.quit 3
end if
if (dimensions) then
wscript.stdout.writeline( "Dimensions Filter Enabled: x=" + x + " y=" + y)
VideoReDo.FileSetFilterDimensions x, y
end if
' Open output file and start processing.
outputFlag = VideoReDo.FileSaveAs( destFile, profileName )
outputXML = ""
if outputFlag = false then
wscript.stderr.writeline("? Problem opening output file: " + destFile )
wscript.stderr.writeline(outputXML)
wscript.quit 4
end if
' Wait until output done.
while( VideoRedo.OutputGetState <> 0 )
percent = "Progress: " & Int(VideoReDo.OutputGetPercentComplete()) & "%"
wscript.echo(percent)
if not fso.FileExists(lockFile) then
VideoReDo.OutputAbort()
endtime = DateAdd("s", 15, Now)
while( VideoReDo.OutputGetState <> 0 And (Now < endtime) )
wscript.sleep 500
wend
VideoReDo.ProgramExit()
wscript.quit 5
end if
wscript.sleep 2000
wend
VideoReDo.ProgramExit()
' Exit with status 0
wscript.echo( " Output complete to: " + destFile )
wscript.quit 0