Event2SubClips with names

notami wrote on 12/29/2004, 6:42 PM
I've been using the script below to create sub clips from events.
I would like to alter the script to name the sub clips with existing makers names.
I've searched various forums thinking I could hack something together but,
I'm clueless when it comes to scripting. Any help or a push in the right direction would be most appreciated.

//******************************************
import System.Windows.Forms;
import Sony.Vegas;

var trackEnum = new Enumerator(Vegas.Project.Tracks);
var track : Track = Track(trackEnum.item());
var eventEnum = new Enumerator(track.Events);
var evnt : TrackEvent = TrackEvent(eventEnum.item());
var path = evnt.ActiveTake.MediaPath;
var markerEnum = new Enumerator(Vegas.Project.Markers);
var firstMarker = markerEnum.item();
markerEnum.moveNext();
var lastMarker = markerEnum.item();
var idSubclip = 1;

try
{
while (!markerEnum.atEnd()) {
var mySubclip = new Subclip (path, firstMarker.Position, lastMarker.Position -
firstMarker.Position, false, "Subclip "+idSubclip);

firstMarker = lastMarker;
markerEnum.moveNext();
lastMarker = markerEnum.item();
idSubclip++;

}
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
//******************************************

thanks,
Bruce

Comments

jetdv wrote on 12/30/2004, 6:33 AM
In this line:
var mySubclip = new Subclip (path, firstMarker.Position, lastMarker.Position -
firstMarker.Position, false, "Subclip "+idSubclip);

change: "Subclip "+idSubclip

to: firstMarker.Label


FYI, Tsunami has the "Extract Good Clips" tool which will do exactly what you are wanting and then some.