Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro script for changing several stills length

  • script for changing several stills length

    Posted by Gilles Gagnon on January 14, 2010 at 4:31 pm

    Is there a script out there for changing the length of many stills on the timeline?

    It’s unfortunate that this can’t be done natively.

    Thanks,
    g

    Mark Greenwood replied 16 years, 3 months ago 4 Members · 11 Replies
  • 11 Replies
  • Theo Van laar

    January 14, 2010 at 4:44 pm

    I always use Excalibur for this, but this scripting plugin is not free.
    https://www.jetdv.com/excalibur/veldur.php#top

    Theo

  • Gilles Gagnon

    January 14, 2010 at 4:47 pm

    thanks,
    I’ll check it out.

  • John Rofrano

    January 14, 2010 at 9:19 pm

    You could also use Ultimate S Lite or Ultimate S Pro. Investing in a scripting tool like Ultimate S or Excalibur can save you hours and hours of time.

    ~jr

    http://www.johnrofrano.com
    http://www.vasst.com

  • Gilles Gagnon

    January 14, 2010 at 9:21 pm

    thanks, will look into these as well.
    g

  • Theo Van laar

    January 14, 2010 at 10:51 pm

    ‘You could also use Ultimate S Lite or Ultimate S Pro. Investing in a scripting tool like Ultimate S or Excalibur can save you hours and hours of time. ‘

    Yes, sorry not to mention Ultimate S. Also the Production Assistant is very usefull to mention since it also performs the task. All these tools have so many different (and overlapping possibilities), that you will never regret when you purchase one or two…

    Theo

  • Gilles Gagnon

    January 14, 2010 at 11:13 pm

    I can’t seem to get on the vasst site to check out Ultimate S. I get some mailer page instead of the actual website. Is it me or are they experiencing problems?
    g

  • Theo Van laar

    January 14, 2010 at 11:30 pm

    I also can’t get into the VASST site. But I will attach the manual for Ultimate S so that you can have a look (I hope this is allowed…)

    482_ultimatespro4usersguide.pdf.zip

    Theo

  • Gilles Gagnon

    January 14, 2010 at 11:42 pm

    Thanks for confirming Theo and for uploading the doc.

    I got it and will have a look at it. Will check back on the vasst site later to check for price, etc.
    g

  • Mark Greenwood

    January 15, 2010 at 4:59 am

    Copy this into a notepad file – save it out with a .CS file extension (something like IncreaseTime.cs) and copy it into your script folder (typically c:\program files\sony\vegas pro 9.0\script menu).

    Then run Vegas – select the events you aent to increase and run the script – type in or use the up down arrows to select the number of milliseconds for each clip (1000 per second) – it will then increase all of the images / media. Note that it will also move the start position of multiple events on a track – for some reason it has a little issue with overlapping video events which I’ll have to investigate when I have a moment.

    Also note that if you do this on Video or Audio and not images it will actually set the DURATION – which means that they might run quicker or slower – so probably best used for images only!

    Mark.


    using System;
    using System.Text;
    using Sony.Vegas;
    using System.Windows.Forms;

    namespace IncreaseLength
    {
    ///

    /// Entry point from Vegas
    ///

    public class EntryPoint
    {
    ///

    /// What vegas calls
    ///

    /// public void FromVegas(Vegas vegas)
    {
    // Put an exception handler around the FORM
    try
    {
    IncreaseLengthForm ic = new IncreaseLengthForm(vegas);
    ic.ShowDialog();
    }
    catch (Exception ex)
    {

    }
    }
    }

    public class IncreaseLengthForm : Form
    {
    protected Vegas m_vegas;

    public IncreaseLengthForm(Vegas vegas)
    {
    InitializeComponent();
    m_vegas = vegas;
    }

    private Button btApply;
    private Button btCancel;
    private Label label1;
    private NumericUpDown nmDuration;

    ///

    /// Required designer variable.
    ///

    private System.ComponentModel.IContainer components = null;

    ///

    /// Clean up any resources being used.
    ///

    /// true if managed resources should be disposed; otherwise, false.
    protected override void Dispose(bool disposing)
    {
    if (disposing && (components != null))
    {
    components.Dispose();
    }
    base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    ///

    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    ///

    private void InitializeComponent()
    {
    this.btApply = new System.Windows.Forms.Button();
    this.btCancel = new System.Windows.Forms.Button();
    this.label1 = new System.Windows.Forms.Label();
    this.nmDuration = new System.Windows.Forms.NumericUpDown();
    ((System.ComponentModel.ISupportInitialize)(this.nmDuration)).BeginInit();
    this.SuspendLayout();
    //
    // btApply
    //
    this.btApply.Location = new System.Drawing.Point(118, 70);
    this.btApply.Name = "btApply";
    this.btApply.Size = new System.Drawing.Size(75, 23);
    this.btApply.TabIndex = 0;
    this.btApply.Text = "Apply";
    this.btApply.UseVisualStyleBackColor = true;
    this.btApply.Click += new System.EventHandler(this.btApply_Click);
    //
    // btCancel
    //
    this.btCancel.Location = new System.Drawing.Point(37, 70);
    this.btCancel.Name = "btCancel";
    this.btCancel.Size = new System.Drawing.Size(75, 23);
    this.btCancel.TabIndex = 1;
    this.btCancel.Text = "Cancel";
    this.btCancel.UseVisualStyleBackColor = true;
    //
    // label1
    //
    this.label1.AutoSize = true;
    this.label1.Location = new System.Drawing.Point(13, 13);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(121, 13);
    this.label1.TabIndex = 2;
    this.label1.Text = "Make all items length of:";
    //
    // nmDuration
    //
    this.nmDuration.Increment = new decimal(new int[] {
    100,
    0,
    0,
    0});
    this.nmDuration.Location = new System.Drawing.Point(37, 30);
    this.nmDuration.Maximum = new decimal(new int[] {
    100000,
    0,
    0,
    0});
    this.nmDuration.Minimum = new decimal(new int[] {
    100,
    0,
    0,
    0});
    this.nmDuration.Name = "nmDuration";
    this.nmDuration.Size = new System.Drawing.Size(156, 20);
    this.nmDuration.TabIndex = 3;
    this.nmDuration.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
    this.nmDuration.ThousandsSeparator = true;
    this.nmDuration.Value = new decimal(new int[] {
    100,
    0,
    0,
    0});
    this.nmDuration.Leave += new System.EventHandler(this.nmDuration_Leave);
    //
    // IncreaseLengthForm
    //
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(206, 105);
    this.Controls.Add(this.nmDuration);
    this.Controls.Add(this.label1);
    this.Controls.Add(this.btCancel);
    this.Controls.Add(this.btApply);
    this.Name = "IncreaseLengthForm";
    this.Text = "IncreaseLengthForm";
    ((System.ComponentModel.ISupportInitialize)(this.nmDuration)).EndInit();
    this.ResumeLayout(false);
    this.PerformLayout();

    }

    #endregion

    private void nmDuration_Leave(object sender, EventArgs e)
    {

    }

    private void btApply_Click(object sender, EventArgs e)
    {
    double duration = (Convert.ToDouble(nmDuration.Value));

    // For each track
    for (int iCount = 0; iCount < m_vegas.Project.Tracks.Count; iCount++) { // Get this Track Track t = m_vegas.Project.Tracks[iCount]; // Now for each track event in that track for (int iTrackEvent = 0; iTrackEvent < t.Events.Count; iTrackEvent++) { // Get this track event TrackEvent ev = t.Events[iTrackEvent]; // How much longer or shorter is this track now double dbCurrent = ev.Length.ToMilliseconds(); double dbDifference = 0; dbDifference = duration - dbCurrent; // Only move and increase if it is selected if (ev.Selected == true) { // Move ALL of the events on this track the increased distance MoveAllEvents(t, ev.Index, dbDifference); // Increase the length of this event ev.Length = Timecode.FromMilliseconds(duration); } } } // Now close this this.Close(); } protected void MoveAllEvents(Track t, int iIndex, double dbPosition) { foreach (TrackEvent ev in t.Events) { if (ev.Index > iIndex)
    {
    ev.Start += Timecode.FromMilliseconds(dbPosition);
    }
    }
    }
    }
    }

  • Gilles Gagnon

    February 8, 2010 at 2:55 pm

    Hi Mark,

    I finally tried the script as indicated and when I run it I get the error:

    System.ApplicationException: Failed to create instance of main class: ‘EntryPoint’.
    at Sony.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
    at Sony.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

    any idea?
    Thanks,
    Gilles

Page 1 of 2

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