Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro How to pull a script from a web page

  • How to pull a script from a web page

    Posted by Grace Hunter on June 25, 2014 at 1:39 am

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

    }

    Matt Carlson replied 11 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Matt Carlson

    June 25, 2014 at 2:14 am

    I answered in the other thread as well… the extension needs to be .cs for the script.

    If you want to avoid any copy/paste problems here is a link to the script file

    7669_closegapsmultipletracks.cs.zip

  • Matt Carlson

    June 25, 2014 at 4:33 am

    I see the problem here. The Creative Cow forum is messed up. In order for scripts to show up nicely in a post we are given a code tag to wrap them in. This tag is supposed to keep it nice to look at and not use any of the other filters that the forum posts use. Unfortunately the the code tag is broken it seems. It is filtering out < > symbols. The List lines should read like: new List< TrackEvent > (); These have been removed by the filters breaking the script.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy