Sure. What I would do in the script is to set the ruler format to measures and beats. Then dropping markers at the start of each measure like this:
/**
* Program: MeasureMarkers.js
* Description: This script will set markers at measure boundaries
* Author: Johnny (Roy) Rofrano jrofrano at vasst.com
* Date: September 26, 2005
*
**/
import System.Windows.Forms;
import Sony.Vegas;
var maxMeasures : int = 10;
try
{
// always save anything we intent to change
var savedRulerFormat : RulerFormat = Vegas.Project.Ruler.Format;
// set the ruler format to measures and beats
Vegas.Project.Ruler.Format = RulerFormat.MeasuresAndBeats;
var count : int = 0;
for(var i : int = 1; i <= maxMeasures; i++)
{
var position : String = String.Format("{0}.1.000", i);
var measure : Marker = new Marker(new Timecode(position), position);
try
{
Vegas.Project.Markers.Add(measure);
count++;
}
catch(err)
{
MessageBox.Show("Marker already exists at: " + position);
}
}
// restore project ruler format to what it was
Vegas.Project.Ruler.Format = savedRulerFormat;
// give feedback
MessageBox.Show(count + " measure markers added.");
}
catch (e)
{
MessageBox.Show(e);
}
Here's a modification to John's script that should do what you want:
/**
* Program: MeasureMarkers.js
* Description: This script will set markers at measure boundaries
* Author: Johnny (Roy) Rofrano jrofrano at vasst.com
* Date: September 26, 2005
*
**/
import System.Windows.Forms;
import Sony.Vegas;
var maxMeasures : int = 10;
try
{
// always save anything we intent to change
var savedRulerFormat : RulerFormat = Vegas.Project.Ruler.Format;
// set the ruler format to measures and beats
Vegas.Project.Ruler.Format = RulerFormat.MeasuresAndBeats;
var count : int = 0;
for(var i : int = 1; i <= maxMeasures; i++)
{
for(var j : int = 1; j <= 4; j++)
{
var position : String = String.Format("{0}.{1}.000", i, j);
var measure : Marker = new Marker(new Timecode(position), position);
try
{
Vegas.Project.Markers.Add(measure);
count++;
}
catch(err)
{
MessageBox.Show("Marker already exists at: " + position);
}
}
}
// restore project ruler format to what it was
Vegas.Project.Ruler.Format = savedRulerFormat;
// give feedback
MessageBox.Show(count + " measure markers added.");
}
catch (e)
{
MessageBox.Show(e);
}
All the "Markers" will be the same color - orange. Now you can also have Command Markers which are blue and Regions which are Green. The script could be modified to use one of them instead.
/**
* Program: MeasureMarkers.js
* Description: This script will set markers at measure boundaries
* Author: Johnny (Roy) Rofrano jrofrano at vasst.com
* Date: September 26, 2005
*
**/
import System.Windows.Forms;
import Sony.Vegas;
var maxMeasures : int = 10;
try
{
// always save anything we intent to change
var savedRulerFormat : RulerFormat = Vegas.Project.Ruler.Format;
// set the ruler format to measures and beats
Vegas.Project.Ruler.Format = RulerFormat.MeasuresAndBeats;
var count : int = 0;
for(var i : int = 1; i <= maxMeasures; i++)
{
for(var j : int = 1; j <= 4; j++)
{
var position : String = String.Format("{0}.{1}.000", i, j);
if (j == 1)
{
var Rmeasure : Region = new Region(new Timecode(position), new Timecode("0.0.001"), position);
try
{
Vegas.Project.Regions.Add(Rmeasure);
Rmeasure.Length = new Timecode(0);
count++;
}
catch(err)
{
MessageBox.Show("Region already exists at: " + position);
}
}
else
{
var measure : Marker = new Marker(new Timecode(position), position);
try
{
Vegas.Project.Markers.Add(measure);
count++;
}
catch(err)
{
MessageBox.Show("Marker already exists at: " + position);
}
}
}
}
// restore project ruler format to what it was
Vegas.Project.Ruler.Format = savedRulerFormat;
// give feedback
MessageBox.Show(count + " measure markers added.");
}
catch (e)
{
MessageBox.Show(e);
}