I'm trying to modify the default batch render script, so it will place the region names in the files.
Is that possible ?
What do I need to do to make this work ?
P.S.
Are there third party batch tools available ?
I must be missing something. I replaced "filename" with "region.Label" and I get an error message (System.ArgumentException: directory does not exist). I'm not very proficient with programming and a total novice to scripts. Additional advice would be appreciated - thanks!!!
Yeah, that one caught me a few times, but I finally figured it out (i.e., point to a valid folder). After playing with it a bit more, I've isolated the problem somewhat. The script works fine in Vegas 6.0. But I've been playing with the 7.0 Demo and that's where it's not working. Why that's the case, I have no idea, but suffice it to say it works fine in 6.0d and does not work in 7.0a.
One other comment. In 7.0 it never even opens the dialog box. I get this error message:
C:\Program Files\Sony\Vegas 7.0\Script Menu\Batch Render Using Region Names.cs(175) : Warning as Error: 'System.IO.Path.InvalidPathChars' is obsolete: 'Please use GetInvalidPathChars or GetInvalidFileNameChars instead.'
C:\Program Files\Sony\Vegas 7.0\Script Menu\Batch Render Using Region Names.cs(194) : Warning as Error: 'System.IO.Path.InvalidPathChars' is obsolete: 'Please use GetInvalidPathChars or GetInvalidFileNameChars instead.'
That's because Vegas 7 uses .NET 2.0 and Vegas 6 uses .NET 1.1. Are you using the version that CAME with Vegas 7? Or trying to use the version you modified for Vegas 6? You might try opening the Vegas 7 version and adding your modifications there.
Does anyone know how to modify the "batch render" script in Vegas 7 so that the region name can replace the "filename" variable ? I'm not too familiar with js, cs or vb coding and can't see how to fetch up the region label and stuff it into the "filename" variable. At least I know the "event" file names can be fetched as John Meyer has done that in his script that names the regions by the event filenames. What I want to do is output each of the events on the timeline as a .avi file preserving the original filename of that event. Why would I want to do that? File conversion of tricky MP4 files that just don't seem to want to work all the time in Vegas 7.
Got it.
First I use John Meyer's script that creates regions from event file names http://www.vasst.com/search.aspx?category=Regions
This amazing script works perfectly and does the work of getting
the fie names I wanted.
Then I made the following changes to Vegas 7's Batch Render.cs to actually
output the files.
String defaultBasePath = "Please browse for output path";
// this created an error and makes me browse for the output path
// but it does not append to any file name
String filename = Path.Combine(outputDirectory,
FixFileName("A") +
FixFileName("") +
"-" +
FixFileName(""));
// This changes the filename variable to "A-" for a prefix to my
// final name.
String regionFilename = String.Format("{0}{1}{2}",
filename,
region.Label,
//regionIndex.ToString(),
renderItem.Renderer.FileExtension.Substring(1));
// I deleted the brackets in the string formating as I didn't want them
// I left filename in as it is now filled with a prefix of "A-" which I wanted.
// I added the region.Label next to pickup the region labels
// that John Meyer's script created from the original event file names.
// and commented out the incrementing final digit as each
// name is now unique anyway
dlog.Text = "Batch Render2";
// this shows up in Vegas script tool window
Thanks to all who contribute to this forum. I have little knowledge of
cs or js coding or the Vegas API but all your posts and scripts helped
me get this done....And especially you John ! Your scripts are first rate !!
So i found a way to have it that it only saves it with your Regional Name and not what you rendered with or random name you put into Directory bar when running a script,
I replaced the following;
// construct the file name (most of it)
String filename = Path.Combine(outputDirectory,
FixFileName(baseFileName) +
FixFileName(renderItem.Renderer.FileTypeName) +
"_" +
FixFileName(renderItem.Template.Name));
With This;
// construct the file name (most of it)
String filename = Path.Combine(outputDirectory,
" " );
The above made it that it still finds your location you want to save it but doesn't add the filename you put into the directory field but replaces it with a " "
This ended up with the regional name being the only thing set as the file name if this is just what you want and not the extras that come along with batch renders,