-
Script – Reference Comp by name instead of by index
I have this Script:
var myComp = app.project.activeItem;
var myLayer = app.project.item(4).layer(1);
myComp.duration = (myLayer.outPoint - myLayer.inPoint);This script changes the duration of the main composition, based on the way I made reference by index.
Instead of use:
app.project.item(4).layer(1);The path is: (4) Fourth Comp inside Main composition and within, the (1) first layer.I made several unsuccessful attempts. It’s not like in expressions.
I need to use names. Which are independent of the numerical order of layers within the composition.
- With these names:
- (4) = “Footage”
- (1) = “Video”
Thanks.