Comments

jetdv wrote on 4/28/2003, 10:12 AM
Probably the EASIEST way, left-click the first event (to select it), then right-click on the first event and choose "Select Events to End". Then you could press Delete to delete them or CTRL-C to copy them
bcgreen wrote on 4/28/2003, 11:23 AM
But I'm trying to learn scripting, and would like to know how I would do this with a script...

Thanks,
Bryan

jetdv wrote on 4/28/2003, 11:45 AM
Well... That's a different story. Here's something to get you started. This script will select all events on the selected track. However, note that it is not necessary to actually select an event in order to delete it. Copying is not yet an option but should be in the next release (1.0c). You can, kind of, fake a copy by creating a new event from the same section of the same media file but effects will be lost.


/**
* This script will select all events on the selected track
* Written By: Edward Troxel
* www.jetdv.com/tts
* Modified: 04/28/2003
**/

import System;
import System.IO;
import System.Windows.Forms;
import SonicFoundry.Vegas;


try {

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

var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());

evnt.Selected = true;

eventEnum.moveNext();
}


} 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;
}