ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Extendscript - get name of comp which a layer is in?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeroen Rommelaars
Extendscript - get name of comp which a layer is in?
on Sep 24, 2019 at 3:24:35 pm

Hey guys,

Im trying to build something here, but im running into some issues.
Im doing all kinds of for loops to find layers in my project - in the entire project. The layers I want to find are color coded, or locked, or shy for example.
If one of those layers is found, i would like to get the name of the composition that layer was found in. Preferrably the sourcename of that comp, but a name would be a great starting point.

Now most of the scripting goes from toplever down to layer level - like project, comp, layer - but in this case i would like to do it inside out, from layer, to comp, etc.

Does anyone know a way to find the compname in which a layer is present through extendscript?

Any help is much appreciated!

Thanks!

//this looks for darkgreen labeled layers - but now i need the compnames of the comps that have those layers in them
function greenCheckFunction() {

for (var h = 1; h &lt;= app.project.numItems; h++)
if (app.project.item(h) instanceof CompItem)
for (var i = app.project.item(h).numLayers; i > 0; i--) {
if (app.project.item(h).layer(i).label == 16) {
exclusionArray.push(app.project.item(h).layer(i).name)
}
}
}


Return to posts index

Dan Ebberts
Re: Extendscript - get name of comp which a layer is in?
on Sep 24, 2019 at 4:32:52 pm

YourLayer.containingComp will give the comp that the layer is in, but I don't understand how you get to the layer without already knowing the comp.

Dan



Return to posts index

Jeroen Rommelaars
Re: Extendscript - get name of comp which a layer is in?
on Sep 24, 2019 at 4:55:15 pm

Ooh, im gonna try that first thing in the morning.

I get the layer in a for loop, linked in the above post. The loop just runs. I could probably extract the index number of the comp for a specific layer from that loop, but i need the comp name. Ofcourse...now that you mention it...i probably couldve gotten the index number, and then simply check the name for said index number. Hmmmmm

Although i like your approach better ☺
Thanks!


Return to posts index

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