batch render with same filename

malowz wrote on 12/21/2011, 5:20 PM
hi guys, im looking if anyone can help me, i was wondering if there are any scripts (jscript) around that batch render events from timeline (or files from folder) and get the filename/path from the event.

the current ones i found, they create markers and render between them, so they are kind of "blind" on the event path. (render as sequence number)

any help appreciated ;)

OBS: im not looking for commercial or "closed" scripts to do this, as the script will automate more functions.

Comments

johnmeyer wrote on 12/24/2011, 5:52 PM
... batch render events from timeline (or files from folder) and get the filename/path from the event.

I think you probably know that, in Vegas terminology, and event is an object on the timeline, but that many events can come from the same file name.

I am not entirely sure what you want to do, but here is a jscript script that I wrote which does part of what you asked for. However, as noted in the comments at the top of the script, if you have multiple events on the timeline that come from the same media file, this script (as written) will result in duplicate file names. You could easily add some code that appends a counter number to the end of each file name in order to avoid that duplication.

This script creates and names the regions. You can then simply use the Batch GUI script included with Vegas to actually do the rendering.

/**
* This script will add regions for all events on the selected track,
* and name those regions to the event's media file name.
*
* If more than one event comes from the same media, this will result in
* duplicate region names.
*
* By John Meyer 4/11/2005
*
**/

import System;
import System.IO;
import System.Windows.Forms;
import Microsoft.Win32;
import Sony.Vegas;
var evnt : TrackEvent;
var myRegion : Region;
var RegionNumber;
var RegionName : String;


try {

//Find the selected event
var track = FindSelectedTrack();
if (null == track)
throw "no selected track";

var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
var MyFilePath = evnt.ActiveTake.MediaPath;
var extFileName = Path.GetFileName(MyFilePath);
var baseFileName = Path.GetFileNameWithoutExtension(extFileName); // Media file name for this event

myRegion = new Region(evnt.Start,evnt.Length,baseFileName); //Insert a region over this event
Vegas.Project.Regions.Add(myRegion);
eventEnum.moveNext();
RegionNumber++;
}

} catch (e) {
MessageBox.Show(e);
}


function FindSelectedTrack() : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}




malowz wrote on 12/31/2011, 11:58 AM
tnks johnmeyer. your code had the functions i needed to get mine done ;)

i did a batch render to create proxy files and 2 more to convert between them, so i needed the event name to find the file to exchange. now its working fine ;)

tnks again for your work. most of my scripts are based on your code ;)