Code: Select all
///////////////////////////////////// Begin new script for slates
//"Update Project Name Text" script, version 1.3.
//This script was created by Christopher R. Green on 5-8-2005
// (modified 5-9-2005)
// using Tex-Edit Plus and jEdit.
//This script will look for all text layers named "projectname" (or whatever
// the variable below is set to) and set the source text of those layers to the project name.
//If you have questions, you can make a post or
// send an email via creativecow.net (After Effects forum)
// or aenhancers.com (I am 'zold' there)
//You are free to use this script however you please.
//If you make changes to it, please tell me (CRG) about it.
//put inside undo block:
app.beginUndoGroup("Update Project Name Text");
var p=app.project;
var projTLayersFound=[];
var projTextName = "projectname";
//get project name:
var projName = p.file.name.replace(/%20/g, "_").replace(/\.(.{3,4}$)/, "");
var didNotFindOne = true;
//loop through comps and layers:
for (i = 1; i <= app.project.numItems; ++i) { //for/next loop goes through all project items
var currentComp = p.item(i);
if (currentComp instanceof CompItem) { //test if current item is a composition
//if it is a comp item, look for the "projectname" text layer
var theseLayers=currentComp.layers;
for (o = 1; o <= theseLayers.length; ++o) { //this loop goes through all layers
var currentLayer = theseLayers[o];
//make sure it's a text layer, and that its name is correct
//(ignore if it's not a text layer or it's a text layer with wrong name)
if ( (currentLayer.property("sourceText") != null) && (currentLayer.name == projTextName) ) {
didNotFindOne = false;
//set its value:
currentLayer.sourceText.setValue(projName);
}
}//inner for
}//if compItem
}//outer for
if (didNotFindOne) { alert("No \"projectname\" text layer found in this project!"); }
app.endUndoGroup();
//End update slates named "projectname"
/////////////////////////////
////////////////////////////
////////////////////////////
//Begin update of main slate version number only text
//"Update Project Name Text" script, version 1.3.
//This script was created by Christopher R. Green on 5-8-2005
// (modified 5-9-2005)
// using Tex-Edit Plus and jEdit.
//This script will look for all text layers named "version" (or whatever the variable below is set to) and set the source text of those layers to the project name.
//If you have questions, you can make a post or
// send an email via creativecow.net (After Effects forum)
// or aenhancers.com (I am 'zold' there)
//You are free to use this script however you please.
//If you make changes to it, please tell me (CRG) about it.
//put inside undo block:
app.beginUndoGroup("Update Project Slate Text");
var p=app.project;
var projTLayersFound=[];
var projTextName = "version";
//get project name:
var projName = ( p.file.name.replace(/%20/g, "_").replace(/\.(.{3,4}$)/, "").replace(/(^.{1,}?)\_/, "") );var didNotFindOne = true;
//loop through comps and layers:
for (i = 1; i <= app.project.numItems; ++i) { //for/next loop goes through all project items
var currentComp = p.item(i);
if (currentComp instanceof CompItem) { //test if current item is a composition
//if it is a comp item, look for the "version" text layer
var theseLayers=currentComp.layers;
for (o = 1; o <= theseLayers.length; ++o) { //this loop goes through all layers
var currentLayer = theseLayers[o];
//make sure it's a text layer, and that its name is correct
//(ignore if it's not a text layer or it's a text layer with wrong name)
if ( (currentLayer.property("sourceText") != null) && (currentLayer.name == projTextName) ) {
didNotFindOne = false;
//set its value:
currentLayer.sourceText.setValue(projName);
}
}//inner for
}//if compItem
}//outer for
if (didNotFindOne) { alert("No \"version\" text layer found in this project!"); }
app.endUndoGroup();