Expression request: Updating slate

Moderators: Disciple, zlovatt

Post Reply
kennethbonde
Posts: 7
Joined: March 17th, 2008, 3:25 pm

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: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

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:

Code: Select all

parts = Date(0).toUpperCase().split(" ");
parts[0] + " " + parts[1] + " " + parts[2] + " " + parts[3]
And you can get the Comp Name like this:

Code: Select all

thisComp.name
-Lloyd
Post Reply