Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Deleting empty space lining up clips from all tracks

  • Deleting empty space lining up clips from all tracks

    Posted by Grace Hunter on June 24, 2014 at 6:32 pm

    So I have five different tracks in my timeline, and I have to click and drag the clips together until I see the blue snap line to get all the clips to line up on their respective rows. This is what I mean:

    I don’t want any of the video layers to play on top of each other, but I want there to be no empty space between the clips on all five tracks collectively, as if there was only one track with no space in between the clips, if that makes any sense. Is there a script to do this? Or an easier way?

    Matt Carlson replied 12 years, 1 month ago 2 Members · 3 Replies
  • 3 Replies
  • Matt Carlson

    June 24, 2014 at 8:40 pm

    This script should do what you are asking. The script as written will concatenate all the events in the project. If there are other events not shown in your screen grab that you do not want affected or you just want to do selected events you need to change the line

    bool ALLEVENTS = true;

    to

    bool ALLEVENTS = false;

    When set to false the script will only concatenate events that are selected (obviously you have to have selected events for this to work).


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

    }

  • Grace Hunter

    June 25, 2014 at 12:08 am

    Thank you so much! I however, have run into a problem. I feel like an idiot, but I just got vegas pro a couple days ago, and I am new to scripts. I have pasted the script into text edit, and put .js at the end of the name, but when I try to use the script, this is what happens:

    I have used another script for vegas pro, and it worked, but the difference is that I downloaded the file directly from the internet, I didn’t copy and paste it. So…how do I do that?

  • Matt Carlson

    June 25, 2014 at 2:06 am

    Scripts can either be .js (Javascript) or .cs (C#)

    This is done in C# so the extension needs to be .cs

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