ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

AE COMP Name Script

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Philip Francís
AE COMP Name Script
on Jan 25, 2017 at 12:09:53 am

I have this script which grabs the name of the top most layer in AE.

txt = "";
for (i = 1; i <= thisComp.numLayers; i++){
if (i == index) continue;
L = thisComp.layer(i);
if (! (L.hasVideo && L.active)) continue;
try{
txt = L.source.name;
}catch(err){
txt = L.name
}
break;
}
txt

Any way to change it so it grabs the lowest layer in the comp..?


Return to posts index

Walter Soyka
Re: AE COMP Name Script
on Jan 25, 2017 at 2:30:35 pm

Point of pedantry: this is an expression, not a script. Expressions are evaluated, calculated as values for properties on-the-fly, as the comp renders. Scripts are executed and perform actions.

If we change the for loop, we can make this expression grab the name of the source of the lowest active layer:

txt = "";
for (i = thisComp.numLayers; i >= 1; i--){
if (i == index) continue;
L = thisComp.layer(i);
if (! (L.hasVideo && L.active)) continue;
try{
txt = L.source.name;
}catch(err){
txt = L.name
}
break;
}
txt


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Philip Francís
Re: AE COMP Name Script
on Feb 5, 2017 at 5:48:14 pm

Thanks, cleared up a major problem I was having!!


Return to posts index

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