ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

ExtendScript - How to find & select a comp and edit the Text layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joe Richardson
ExtendScript - How to find & select a comp and edit the Text layer?
on Mar 5, 2020 at 8:35:00 am
Last Edited By Joe Richardson on Mar 5, 2020 at 9:23:13 am

I've been trying to figure out how to find and select a comp, and then edit the text layer without opening. I was hoping to set its value using a user-prompt string that's pasted in when the script is invoked.

This script keeps returning the result as undefined, so I can't make any progress.

var myPath = prompt("Directory?", "Paste path")
for (var i = 1; i <= app.project.numItems; i ++) {
if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name =="DataPath")) {
var myComp = app.project.item(i);
break;
}
}


Edit::

So I think I was just typing in the wrong comp name.

The only thing I wanted to figure out at this point was how to set the value of a text layer. Something like redefinery's rd: Edit Text script where the text is the stuff i paste into the prompt at the beginning of the script, without changing the expression in the text layer.


Return to posts index

Andrei Popa
Re: ExtendScript - How to find & select a comp and edit the Text layer?
on Mar 5, 2020 at 11:58:11 am

like this:

app.project.activeItem.layer("your text layer")("ADBE Text Properties")("ADBE Text Document").setValue("Here is the new values of the text")

Andrei
My Envato portfolio.


Return to posts index

Joe Richardson
Re: ExtendScript - How to find & select a comp and edit the Text layer?
on Mar 5, 2020 at 1:09:58 pm

Ah, ok.

I think I got it:

var myPath = prompt("Directory?", "Paste path")
for (var i = 1; i &lt;= app.project.numItems; i ++) {
if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name =="PathString")) {
var myComp = app.project.item(i);
myComp.layer("MainPathString")("ADBE Text Properties")("ADBE Text Document").setValue(myPath)
break;
}
}



Return to posts index

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