Comments

TheHappyFriar wrote on 12/1/2008, 7:35 PM
you can drag out the region in/out points. There should be a little display above the regions saying the amount of time you've added/removed. You can also have a piece of media the length you want, double click on the media & hit "r" to make that a region.
farss wrote on 12/1/2008, 8:02 PM
Those three boxes at the bottom right hand of the T/L window also let you type in the numbers as well as displaying them.

There's also a script to insert markers at time intervals.
From that it's very simple to create regions of exact lengths.

Bob.
Tim L wrote on 12/1/2008, 8:11 PM
When you drag a (blue) selection region, the three time displays to the lower right of the timeline show the start (in), end (out), and duration of the selection area.

You can double-click any of these three time values and manually enter a new value, and the selection region will adjust accordingly. Then press "R" to create a region.

The trick is that the "duration" of the selection is constant unless you type in a new duration value. If you type in a new IN point and a new OUT point, you don't get a new duration spanning the points you entered. Instead, typing a new IN point simply shifts the existing selection (same duration) to start at the specified point. Typing in a new OUT point simply shifts the existing selection (same duration) to end at the specified point.

When entering new values, you don't need to use proper ":" separators between hh:mm:ss.ff -- the value you enter can use all periods, for example. i.e. enter 1.00.00 for exactly one minute. 30.00 for 30 seconds, etc. (periods are easy because they are right there by the keypad) The number is always interpreted as having the "frames" count at the end, seconds before that, minutes before that, etc.

But creating a piece of media of the specific duration, as TheHappyFriar suggests, might be easier.

(Or at least this is my understanding -- somebody please educate me if I've stated anything wrong...)

Ooops! farss replied while I was typing and experimenting...
johnmeyer wrote on 12/1/2008, 8:12 PM
I took the script that puts markers at intervals and modified it to do the same thing with Regions. This script will put regions at every five seconds, starting with time zero on the timeline. You can change the interval by modifying the script. Copy the code below and paste it into Notepad. Then, save to your script folder and make sure the extension is .js and NOT .txt.

Oh, and because this is a quick and dirty kludge, there is absolutely no error checking. If a region already exists, the script will simply fail. If you specify a region length that is longer than your project, the script will fail.

/**
* This script will add regions at the specified interval
* Copyright John H. Meyer
* December 1, 2008
**/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;

//Change this value to be the desired interval
//Format: hh:mm:ss:ff (hours:minutes:seconds:frames)
var Interval = "00:00:05:00";
var RegionNumber = 1;


try {
var myRegion : Region;
var IncTime : Timecode = new Timecode(Interval);
var CurrTime : Timecode = IncTime;
var PrevTime : Timecode = new Timecode(0);
var EndTime : Timecode = Vegas.Project.Length;

while (CurrTime < EndTime) {
//Put a region at the interval point
myRegion = new Region(PrevTime,CurrTime - PrevTime,RegionNumber.ToString());
Vegas.Project.Regions.Add(myRegion);
PrevTime = CurrTime;
CurrTime = CurrTime + IncTime;
RegionNumber++;
}



} catch (e) {
MessageBox.Show(e);
}



John_Cline wrote on 12/1/2008, 8:49 PM
You don't even need the periods, typing "20000" is the same as "2:00:00" or "2.00.00"

You can also type, "+500" for example, to move the cursor five seconds from where it is currently. +1000 would move it 10 seconds, whereas, typing -2000 would move it back 20 seconds. You get the idea...
kentwolf wrote on 12/1/2008, 9:18 PM
>>Those three boxes at the bottom right hand of the T/L window
>>also let you type in the numbers as well as displaying them.

That's the ticket right there. If you can get comfortable with this, life will be easier.
WarThomas46 wrote on 11/27/2023, 9:12 AM
I took the script that puts markers at intervals and modified it to do the same thing with Regions. This script will put regions at every five seconds, starting with time zero on the timeline. You can change the interval by modifying the script. Copy the code below and paste it into Notepad. Then, save to your script folder and make sure the extension is .js and NOT .txt.

Oh, and because this is a quick and dirty kludge, there is absolutely no error checking. If a region already exists, the script will simply fail. If you specify a region length that is longer than your project, the script will fail.
 
/**

 * This script will add regions at the specified interval

 * Copyright John H. Meyer

 * December 1, 2008

 **/



import System;

import System.IO;

import System.Windows.Forms;

import Sony.Vegas;



//Change this value to be the desired interval

//Format:  hh:mm:ss:ff (hours:minutes:seconds:frames)

var Interval = "00:00:05:00";

var RegionNumber = 1;





try {

  var myRegion : Region;

  var IncTime : Timecode = new Timecode(Interval);

  var CurrTime : Timecode = IncTime;

  var PrevTime : Timecode = new Timecode(0);

  var EndTime : Timecode = Vegas.Project.Length;



  while (CurrTime < EndTime) {

      //Put a region at the interval point

      myRegion = new Region(PrevTime,CurrTime - PrevTime,RegionNumber.ToString()); 

      Vegas.Project.Regions.Add(myRegion);

      PrevTime = CurrTime;

      CurrTime = CurrTime + IncTime;

      RegionNumber++;

  }







} catch (e) {

    MessageBox.Show(e);

}


hi, this no longer work. Do you know how to fix it, please?

jetdv wrote on 11/27/2023, 9:28 AM

Yes, this one will still work. But you will need to change this line for newer versions of VEGAS from:

import Sony.Vegas;

to

import ScriptPortal.Vegas;

For more details, please see this tutorial:

Might help to look at this one too:

johnmeyer wrote on 11/27/2023, 9:32 AM

You PM'd me and since I still use Vegas 13, and haven't followed the changes to scripting language, but JetDV has (and he has always known 100x about scripting compared to me), I assume that his advice will work.

WarThomas46 wrote on 11/27/2023, 9:37 AM

Thank you everyone for helping

john_dennis wrote on 11/27/2023, 10:27 AM

@NickHope did the staff work to document the differences in Sony vintage scripts vs Magix vintage scripts in this FAQ. Look at number 4.

https://www.vegascreativesoftware.info/us/forum/vegas-pro-scripting-faqs-resources--104563/

@WarThomas46