Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions ExtendScript – How to find & select a comp and edit the Text layer?

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

    Posted by Joe Richardson on March 5, 2020 at 8:35 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.

    Joe Richardson replied 6 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    March 5, 2020 at 11:58 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.

  • Joe Richardson

    March 5, 2020 at 1:09 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;
    }
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy