Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions getting active comp name in a script

  • getting active comp name in a script

    Posted by Dirk De jong on October 22, 2017 at 9:19 pm

    Is it possible in a script to find out the actual name of the currently active comp (app.project.activeItem) ?

    My hope would be to then have the script use that name when adding expressions that link from within script generated precomp(s) to params on a control layer which is in the active comp (whose name the script in this case cannot know ahead of time)… Thanks for any replies.

    Dirk De jong replied 8 years, 6 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    October 22, 2017 at 10:29 pm

    This should work:

    var activeCompName = app.project.activeItem.name;

    Dan

  • Dirk De jong

    October 23, 2017 at 1:20 pm

    [Dan Ebberts] “This should work:
    var activeCompName = app.project.activeItem.name;”

    Thanks for the reply Dan –
    A line where I have the script apply an expression in a comp where the specific name is known looks something like this
    myEffect01.property(3).expression = ‘comp(“knownSpecificCompNameGoesHere”).layer(“precomp”).effect(“Slider Control”)(“Slider”)’

    I’m not sure how I’d go about it for an unknown comp name while implementing your suggestion. All my trial and error attempts so far have failed… How would you suggest constructing it so the actual name of the active comp could be added to the expression ? Thanks again for any further info.

  • Dan Ebberts

    October 23, 2017 at 3:59 pm

    Like this:

    var activeCompName = app.project.activeItem.name;”

    myEffect01.property(3).expression = ‘comp(“‘ + activeCompName + ‘”).layer(“precomp”).effect(“Slider Control”)(“Slider”)’

    Dan

  • Dirk De jong

    October 24, 2017 at 12:43 pm

    [Dan Ebberts] “myEffect01.property(3).expression = ‘comp(“‘ + activeCompName + ‘”).layer(“precomp”).effect(“Slider Control”)(“Slider”)'”

    Thanks. I had tried single quotes, double quotes, no quotes – but not triple quotes with plus signs… Now it works just as I had hoped for it to work.

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