-
How to pull a script from a web page
At the bottom of this post is a script. I copied this script from another post, and put it into a notepad document and saved it as a js file. Then I tried to run the script in vegas pro. I got this message:
What’s wrong and how do I not have this problem in the future?
// Close Gaps For Multiple Tracks
using Sony.Vegas;
using System.Collections.Generic;public class EntryPoint {
Vegas myVegas;
//Change this to false if you want to affect only selected events
bool ALLEVENTS = true;public void FromVegas(Vegas vegas)
{
SelectedEvents Selected = new SelectedEvents(vegas,ALLEVENTS);
Selected.SortByStartTime();
for(int i = 0; i < Selected.Events.Count – 1; i++)
{
Selected.Events[i+1].Start = Selected.Events[i].End;
}
}}
public class SelectedEvents
{
public List Events;public SelectedEvents(Vegas vegas, bool allevents)
{
Events = new List();
foreach(Track t in vegas.Project.Tracks)
{
foreach(TrackEvent ev in t.Events)
{
if (ev.Selected || allevents) Events.Add(ev);
}
}
}public void SortByStartTime()
{
Events.Sort((x,y) => x.Start.CompareTo(y.Start));
}}
