ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

getting active comp name in a script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dirk de Jong
getting active comp name in a script
on Oct 22, 2017 at 9:19:09 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.


Return to posts index

Dan Ebberts
Re: getting active comp name in a script
on Oct 22, 2017 at 10:29:43 pm

This should work:

var activeCompName = app.project.activeItem.name;

Dan



Return to posts index

Dirk de Jong
Re: getting active comp name in a script
on Oct 23, 2017 at 1:20:10 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.


Return to posts index


Dan Ebberts
Re: getting active comp name in a script
on Oct 23, 2017 at 3:59:55 pm

Like this:

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

myEffect01.property(3).expression = 'comp("' + activeCompName + '").layer("precomp").effect("Slider Control")("Slider")'


Dan



Return to posts index

Dirk de Jong
Re: getting active comp name in a script
on Oct 24, 2017 at 12:43:59 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.


Return to posts index

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