We use this script and it would be really cool if we could have it as a GUI window.
Code: Select all
////////////////////////////////////////
//"Update Project Name Text" script, version 1.6.
//This script was created by Christopher R. Green on 5-8-2005
// (modified 5-15-2005)
// using Tex-Edit Plus and jEdit.
//This script will look for all text layers named "projectname" and "version" (or whatever
// the variables below are set to) and set the source text of those layers.
//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";
var slateVersName = "version";
//get project name:
//this assumes a project name of the format <foo_v##_##.???> or <foo_v##_##.????> where ??? and ???? are 3 and 4 character file extensions
//the first line here strips the extension, the 2nd line strips the extension and the first part of the base name before the underscore
var projName = p.file.name.replace(/%20/g, "_").replace(/\.(.{3,4}$)/, "");
var versText = ( p.file.name.replace(/%20/g, "_").replace(/\.(.{3,4}$)/, "").replace(/(^.{1,}?)\_/, "") );
var projTLayersFound = 0;
var versTLayersFound = 0;
//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
// and 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) {
if (currentLayer.name == projTextName ) {
projTLayersFound = (projTLayersFound + 1);
//set its value:
currentLayer.sourceText.setValue(projName);
} else if (currentLayer.name == slateVersName ) {
versTLayersFound = (versTLayersFound + 1);
//set its value:
currentLayer.sourceText.setValue(versText);
}
}
}//inner for
}//if compItem
}//outer for
//alert("\n" + "\"" + projTextName + "\" text layers found: " + projTLayersFound + "\n" + "\"" + slateVersName + "\" text layers found: " + versTLayersFound);
app.endUndoGroup();