Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
kennethbonde
Topic Author
Posts: 7
Joined: Mon Mar 17, 2008 3:25 pm

Expression request: Updating slate

Sun Mar 23, 2008 6:56 am

Hi Guy's

I'm trying without luck to modify this script to be an expression.
I want to create a text line slate with "date", "project name" and "comp. name", and want it to update every time the comp. is opened.

Thanks

>kenneth

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

//
//
//Name Stamp by Lloyd Alvarez (July 2006)

// updated Dec 2007
//
//Creates a new Text Layer with the name of the Project
//
//

clearOutput();
app.beginUndoGroup("Project Name Stamp");

var myComp = app.project.activeItem;
var myProj = app.project.file;
if (myProj != null) // make sure proj is saved
{

var myProjName = myProj.name.replace(/%20/gi," ");
var selItems = app.project.selection;
var startPos = [myComp.width * 0.10, myComp.height * 0.15];

for (j=0; j < selItems.length; j++){

myLayer = selItems[j].layers.addText(myProjName);

myLayer.position.setValue(startPos);
writeLn("stamped comp # " + j);

}
app.endUndoGroup();
} else {

alert("You must save and name the project first!");

}
 
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: Thu Jun 17, 2004 9:27 am
Location: New York City, NY
Contact:

Re: Expression request: Updating slate

Fri Apr 04, 2008 1:14 pm

Hey Kenneth,

The reason I wrote it as a script is because you can't access the project name from expressions. You can get date and comp name, though.

You can get the date like this:


parts = Date(0).toUpperCase().split(" ");
parts[0] + " " + parts[1] + " " + parts[2] + " " + parts[3]


And you can get the Comp Name like this:

thisComp.name


-Lloyd

Who is online

Users browsing this forum: No registered users and 3 guests