I have a friend who uses Vegas & wanted to help him modify these 2 scripts he can use for now, until he can buy VP 17 this December & also Vegasaur which I am using & recommended to him.
1.The first script is to delete spaces between selected events but this script does not include the audio in the video that is selected. So maybe if its possible to include the audio also if its highlighted.
2. It's the opposite of the script select all the events at the right of the cursor which is select all events at the left of the cursor.
Thank you & CTTO of this scripts.
/** * Program: * Description: Remove gaps between events. This removes gaps in SELECTED events only. The remove gap function only works on selected events. All events before and after the selected event are NOT processed. The GAP constant is used as the defined spacer between events as they are processed. If you want the space between events to be 0, then set GAP to 0. GAP unit is milliseconds. Default is 1000 (1sec). This script was created because the only other RemoveGaps script found on the interet had a bug where it truncated the end of each event on complex tracks. This script works on complex tracks with 1000's of events. Also the other script processed all events on a track, this script processes only selected tracks, so you can selectivly decide which evemts to process and which to not process. * Author: JRD * * Date: April 17, 2011 **/ import Sony.Vegas; import System.Windows.Forms; import Microsoft.Win32; import System.Diagnostics; try { Debug.WriteLine("RemoveGaps-> START"); var GAP = 0; // step through all selected video events: var FirstTrack : Track = Vegas.Project.Tracks.Item(0); var idx = 0; var countSel = 0; // step through all selected video events: for (var track in Vegas.Project.Tracks) { if( !track.Selected || track.MediaType == MediaType.Audio) continue; var tracktime = new Timecode(0); var last = 0; var begin = 0; for (var evnt in track.Events) { if (evnt.Selected) { // start after first event if (idx > 0 && countSel > 0) { Debug.WriteLine("RemoveGaps-> idx -> " + idx); // get diff between previous this event and last var diff = (evnt.Start.ToMilliseconds() - last); Debug.WriteLine("RemoveGaps-> diff -> " + diff); // if diff is greater than GAP? then fill it if (diff > GAP) { var start = Timecode.FromMilliseconds(last + GAP); var end = Timecode.FromMilliseconds(start.ToMilliseconds() + evnt.Length.ToMilliseconds()); var len = Timecode.FromMilliseconds( evnt.End.ToMilliseconds() - evnt.Start.ToMilliseconds()); Debug.WriteLine("RemoveGaps-> diff > GAP " ); Debug.WriteLine("RemoveGaps-> diff > Set evnt.Start to-> " + start.ToMilliseconds().ToString()); Debug.WriteLine("RemoveGaps-> diff > Set evnt.End to-> " + end.ToMilliseconds().ToString()); Debug.WriteLine("RemoveGaps-> diff > Set evnt.Length to-> " +len.ToMilliseconds().ToString()); evnt.Start = start; // new start evnt.End = end; // new end evnt.Length = len; // calculate exact length countSel++; } } countSel++; } last = evnt.End.ToMilliseconds(); tracktime = tracktime + evnt.Length; idx++; } } Debug.WriteLine("RemoveGaps-> DONE"); } catch (errorMsg) { Debug.WriteLine("RemoveGaps-> ERROR-> " + errorMsg); MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
/** * Program: SelectEventsFromCursor.js * Description: This script will select all the events on all tracks that are * under the cursor position and to the right of it. * Author: Johnny (Roy) Rofrano john_rofrano at hotmail dot com * * Date: March 24, 2004 * **/ import Sony.Vegas; import System.Windows.Forms; try { // step through all the tracks for (var track in Vegas.Project.Tracks) { // Step through all events for (var evnt in track.Events) { // Check to see if event is under or to the right of the cursor if (-1 == Vegas.Cursor.CompareTo(evnt.Start + evnt.Length)) { evnt.Selected = true; } } } } catch (errorMsg) { MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }