Comments

johnmeyer wrote on 10/5/2009, 9:00 AM
I revised a script by Philip which removes all non-active takes from a project. You can then use the lightning bolt icon in the Project media to remove all the un-used media from the project. I have copied that script below, but I commented out a key "if" statement and its companion "end" statement. As a result, the script as copied below will remove ALL takes, leaving you with nothing but empty events. I think this is what you asked for.

I just tested it in Vegas 7, and it does exactly what you asked for.

John
/** 
* Program: RemoveNotActiveTakes.js
* Description: This script will all the takes that's not active.
* Author: Philip
*
* Date: Oct 30, 2003
* Revised: March 31, 2006 by John H. Meyer
* Test on Vegas 6.0d
* Change Log: Changed take removal loop to loop BACKWARDS through ALL takes.
**/

import Sony.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;
import System.Collections;

try
{

// step through all video events:
for (var track in Vegas.Project.Tracks) {
for (var evnt in track.Events) {
for (var i=evnt.Takes.Count - 1; i >= 0; i--) {
// if (!evnt.Takes[i].IsActive) {
evnt.Takes.Remove(evnt.Takes[i]);
// } // End if
} // End for i
} // End for evnt
} // End for track

} // End try

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
Rosebud wrote on 10/5/2009, 9:47 AM
another simplest CS script:


using System;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;
public void FromVegas(Vegas vegas)
{
myVegas = vegas;
foreach (Track track in myVegas.Project.Tracks)
foreach (TrackEvent evnt in track.Events)
evnt.Takes.Clear();
}
}
Yarin VooDoo wrote on 10/5/2009, 11:16 AM
Ciao,

GREAT!!!
Thank you so much, both script works very well! :)

Ciao
Yarin VooDoo wrote on 10/6/2009, 4:43 AM
Ciao,

I'm here again to ask your help.
These scripts can be modified to remove all takes ony from selected events in timeline?

Thanks!

UPDATE

I made this modification, it seems to work:

using System;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;
public void FromVegas(Vegas vegas)
{
myVegas = vegas;
foreach (Track track in myVegas.Project.Tracks)
foreach (TrackEvent evnt in track.Events) {
if (evnt.Selected) {
evnt.Takes.Clear();}
}
}
}


Ciao