I don’t know if there is a script like this out there but I couldn’t find one. I’m doing a picture montage where I have images fading in and out in different quadrants of the screen. I used track motion on 4 different tracks to set up where I want the images but then found it a pain to have to go adjust all the event edges for a 1 sec fade in and 1 sec fade out so I wrote this script to do it. I put in on a button on the toolbar and now I just drop an event on the track, press the fade-in/out button and my images have a 1 second fade on both ends. It’s a trivial script but its handy and quick for this common task. It also works for audio events.
~jr
/**
* Program: FadeEventInOut.js
* Description: This script will add a 1 second fade both ends of the current event
* Author: Johnny (Roy) Rofrano john_rofrano@hotmail.com
*
* Revision Date: June 7, 2003
**/
import SonicFoundry.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;
try
{
var evnt = FindSelectedEvent();
if (evnt == null)
{
throw "Error: You must select an Event.";
}
// Change these next two values if you want a different fade time
evnt.FadeIn.Length = new Timecode(1000);
evnt.FadeOut.Length = new Timecode(1000);
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
/**
* Finds the currently selected event. Searches all tracks and returns the first
* even that is selected or null if no event is selected
* (Taken from the SonicFoundry Scripting FAQ)
*/
function FindSelectedEvent() : TrackEvent
{
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd())
{
var track : Track = Track(trackEnum.item());
var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd())
{
var evnt : TrackEvent = TrackEvent(eventEnum.item());
if (evnt.Selected)
{
return evnt;
}
eventEnum.moveNext();
}
trackEnum.moveNext();
}
return null;
}
~jr