How to adapt a script.cs from frame to seconds, to move the cursor?

cadudesun wrote on 6/14/2020, 11:22 AM

Hi,

 

I'd appreciate your help.

The script.cs below allows to move the cursor left/right on the timeline by frame:

 

----------------------------------------------------------------

using System;

//using System.IO;

//using System.Text;

//using System.Drawing;

using System.Collections;

//using System.Diagnostics;

using System.Windows.Forms;

using ScriptPortal.Vegas;



class EntryPoint

{

    public void FromVegas(Vegas vegas)

    {



    double framerate = (vegas.Project.Video.FrameRate);

    int addFrames = Convert.ToInt32 (framerate);

    addFrames = addFrames * 1;  // number of seconds to be moved

    vegas.Transport.CursorPosition = vegas.Transport.CursorPosition - Timecode.FromFrames(addFrames);



    }



}

----------------------------------------------------------------

 

=> How to adapt it aiming at moving the cursor left/right by "seconds" instead?

For instance, I'd like to move:

- half a second (0.5 seconds)

- 1 second

- 5 seconds

 

Thank you 👍

Comments

altarvic wrote on 6/14/2020, 2:43 PM

Modify this line:

vegas.Transport.CursorPosition = vegas.Transport.CursorPosition - Timecode.FromSeconds(0.5);

 

cadudesun wrote on 6/14/2020, 3:34 PM

Many thanks @altarvic 👍

For reference, the full script adapted to move by 0.5 seconds to the left of the cursor:

using System;

//using System.IO;

//using System.Text;

//using System.Drawing;

using System.Collections;

//using System.Diagnostics;

using System.Windows.Forms;

using ScriptPortal.Vegas;



class EntryPoint

{

    public void FromVegas(Vegas vegas)

    {

    vegas.Transport.CursorPosition = vegas.Transport.CursorPosition - Timecode.FromSeconds(0.5);

    }

}