adding text

richjo100 wrote on 8/1/2005, 4:28 AM
Hello all,

I have done a search for this on the forum and am a bit confused. Im not sure if this is possible esp with Vegas6.0b that is out now.

I want to open a file and then put some text at the beginning of it. For example I would want the text to say "clip1 by xxxx date xx/xx/xx". This text I want to get from a user input . I know how to display a form for this. I just want to know if it is possible to add some text before the a clip automatically. This text can be in any form - subtitles, credit roll or text media.

Thanks in advance

Richard

Richard

Comments

jetdv wrote on 8/1/2005, 6:59 AM
A script cannot currently change the text in the generated media. It can call any preset if you have presets with your designated text/size/position.
johnmeyer wrote on 8/1/2005, 9:52 AM
As I indicated in another post today (in the Vegas forum), I have scripts that take the file name of an event, and then use that text to create region names. These regions can then be exported to a subtitle file, using the script that comes with Vegas.

If you wanted, you could easily change that script and use a form to prompt the user for the text, and use that to create the region name instead.

Here's the script:

/**
* This script will add regions for all events on the selected track,
* and name those regions to the event's media file name.
*
* If more than one event comes from the same media, this will result in
* duplicate region names.
*
* By John Meyer 4/11/2005
*
**/

import System;
import System.IO;
import System.Windows.Forms;
import Microsoft.Win32;
import System.Collections;
import Sony.Vegas;

var evnt : TrackEvent;
var myRegion : Region;
var RegionName : String;


try {

//Find the selected event
var track = FindSelectedTrack();
if (null == track)
throw "no selected track";

var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
var MyFilePath = evnt.ActiveTake.MediaPath;
var extFileName = Path.GetFileName(MyFilePath);
var baseFileName = Path.GetFileNameWithoutExtension(extFileName); // Media file name for this event

var StartTime = evnt.Start;
var LengthTime = evnt.Length;
// if (evnt.FadeIn.Length.Nanos > 0) {
// StartTime = StartTime + evnt.FadeIn.Length;
// LengthTime = LengthTime - evnt.FadeIn.Length;
// }

if (evnt.FadeOut.Length.Nanos > 0) {
LengthTime = LengthTime - evnt.FadeOut.Length;
}

// MessageBox.Show (baseFileName + ", " + evnt.FadeOut.Length);


myRegion = new Region(StartTime,LengthTime,baseFileName); //Insert a region over this event
Vegas.Project.Regions.Add(myRegion);

// Vegas.UpdateUI();


eventEnum.moveNext();
}

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


function FindSelectedTrack() : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}



johnmeyer wrote on 8/1/2005, 5:49 PM
P.S. to last message:

You can download the script (which I cleaned up after posting the above listing). Here's the link:

Event Filename to Regions Script
Vegas - The Big Gamble wrote on 8/14/2005, 6:46 PM
Since I have pretty much given up expecting or waiting for anything to be added to Vegas, I started thinking about alternative ways of adding text..

I guess the most logical way would be to make a script which takes marker labels and turns them into text by calling an external app which makes a transparent title in, for example, PNG format and then imports it. Alternatively it could just take the marker positions in order and read in the text from a text file and do it that way.

Just wondering has anyone done anything like this? If not I'll look into it further. Ideally the app it shells out to should be something well-known which handles batch processing requests and has presets which could be specified.

drew