Spewie:Thank you for the script babgVant.
It works perfectly as long as I output a DVR-MS, however I gave you incomplete information as I would like the output file to be an MPEG.
What I am actually trying to do is:
- Schedule series recording in MCE (done)
- Automatically use a modified "Convert DVR-MS to MPEG w/o commercials" that natively finds commercials (Find Commercials in DVR-MS) and outputs an MPEG
- Rename the output MPEG to <Series> - <Episode>
- Eventually I would have the input file deleted too, once I have it working right
Though I do not care where the renaming takes place, for the time being I would prefer to leave the input file name intact.
That said, in the "c:\program files\dvrmstoolbox\renfile.vbs" "%OutputFile%", can I use either %TempFile% to rename the temporary DVR-MS before it gets converted to MPEG, or can I use %InputFile% to rename the original file before finding comercials and conversion? I can see problems with either as they are changing the names of the files that are still being worked on.
How about something like: "c:\program files\dvrmstoolbox\renfile.vbs" "%InputFile%" "%OutputFile%" that would take the episode information from the input file, but rename the output file?
Thank you again.
'-------------------------------------------------------------------
sub ChangeOutFileName(inFilePath, outFilePath)
dim title, subtitle, folderName, fileName, createDate
dim objShell, objFolder
Dim fso, item, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
folderName = fso.GetParentFolderName(inFilePath)
fileName = fso.GetFileName(inFilePath)
Set objFolder = objShell.Namespace(folderName)
set item = objFolder.ParseName(fileName)
'Wscript.Echo item.name
'10 = album title
title = objFolder.GetDetailsOf(item, 10)
'29 = episode name
subtitle = objFolder.GetDetailsOf(item, 29)
'4 = create date
createDate = objFolder.GetDetailsOf(item, 4)
if subtitle = "" then 'if there isn't an episode name use the create date
subtitle = Replace(Replace(Replace(createDate, "/", "_"), " ", "_"), ":", "_")
end if
set f = fso.GetFile(outFilePath)
f.name = title & " - " & subtitle & "." & fso.GetExtensionName(outFilePath)
set f = nothing
set item = nothing
set objFolder = nothing
set objShell = nothing
set fso = nothing
end sub
dim args
set args = wscript.arguments
ChangeOutFileName args(0), args(1)
set args = nothing
'-------------------------------------------------------------------
usage is as indicated above - "c:\program files\dvrmstoolbox\renfile.vbs" "%InputFile%" "%OutputFile%"
the script should probably have some error checking, or at least error condition checking (i.e. the input/output file need to exist) but this gives the basic framework.