Extendscript for AE. Reference comp by NAME, not by index.
Hi everyone, first time poster.
I'm making my own plugins for AE for my own toolkits.
I have a main composition called MAIN_CONTROL. What i want to do is reference this by the name and not index. I want to see if this comp contains a layer, and run a function based on whether or not it does. So....
var chkLayer = app.project.MAIN_CONTROL.layer("Layer Name");
if (chkLayer == undefined){
//do this
}else{
//do that
}
As of now i can access it by "index" using app.project.item(1).layer("Layer Name")......
But as i build my project and if i re-organize that MAIN CONTROL comp into a subfolder, the index changes and everything breaks.
For some reason this seems so basic, but it is a pain in the butt.
Any help is appreciated.