ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Search Text Layer and Rename

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Juan Carlos Godinez Ramirez
Search Text Layer and Rename
on Apr 19, 2017 at 10:38:05 pm

Hi

I am doing a script that can search all my project after effects a textLayer with name "x" and can modify it without modifying all that exist. But I can not finish it, I hope they can help me, regards.

var myComp;
var myLayer;
var mySourceText;
var textlayer;
myFontName = "info_01";
for (var i = 1; i &lt;= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
myComp = app.project.item(i);
for (var j= 1; j &lt;= myComp.numLayers; j++){
if (myComp.layer(j) instanceof TextLayer ){
textlayer = myComp.layer(j) ;
myLayer = myComp.layer(j).name;
alert (myLayer);

}
}

}



}

}


Return to posts index

Dan Ebberts
Re: Search Text Layer and Rename
on Apr 19, 2017 at 11:22:01 pm

Like this maybe:


var myComp;
var myLayer;
var mySourceText;
var textlayer;
myFontName = "info_01";
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
myComp = app.project.item(i);
for (var j= 1; j <= myComp.numLayers; j++){
if (myComp.layer(j) instanceof TextLayer ){
textlayer = myComp.layer(j) ;
if (textlayer.name == "x"){
textlayer.name = "new name";
}
}
}
}
}



Dan



Return to posts index

Juan Carlos Godinez Ramirez
Re: Search Text Layer and Rename
on Apr 20, 2017 at 3:08:51 am

Hey Dan
Thank you very much! its useful! i agree this my code :

var myComp;
var myLayer;
var mySourceText;
var textlayer;
myFontName = "info_01";
for (var i = 1; i &lt;= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
myComp = app.project.item(i);
for (var j= 1; j &lt;= myComp.numLayers; j++){
if (myComp.layer(j) instanceof TextLayer ){
textlayer = myComp.layer(j) ;
if (textlayer.name == "info 01"){
project = app.project.file.fsName.toString();
mySourceText = textlayer.property("ADBE Text Properties").property("ADBE Text Document");
mySourceText.setValue(project);
}
}
}
}
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]