Forum Replies Created

  • Vitaliy Grebennikov

    July 15, 2021 at 8:21 am in reply to: ExtendScript, refer to the layer by name

    Thx for your attention, Andrei!

    I figured out why this formula didn’t work.

    I tried to figure out this problem for a long time, went through many options, nothing worked, but it gave me a basic understanding of the patterns, and it turned out that the author posted this code simply with syntax errors (apparently, some text editor messed up the text).

    Here is a working formula (I added a little to it so as not to mention the name several times.

    var proj = app.project;
    var itms = proj.items;
    var itmsLen = itms.length;
    var curItem = myComp;
    var layerName = "/YOUR LAYER NAME/";
    for(var i=0; i<itmsLen; i++){
    curItem = itms;
    if(curItem instanceof CompItem){
    if(curItem.name == layerName ){ //Will grab only the first name match
    myComp = curItem;
    break;
    }
    }
    }
    var chkLayer = myComp.layer(layerName );
    if (chkLayer == undefined){
    //do something
    }else{
    //do something else
    }
  • Vitaliy Grebennikov

    July 3, 2021 at 12:58 am in reply to: ExtendScript, refer to the layer by name

    This script don’t work for me(

    I tested it – tried to make layer with specific name to be labeled with some colour, but it doesn’t work…

    var proj = app.project;

    var itms = proj.items;

    var itmsLen = itms.length;

    var curItem, myComp;

    for(var i=0; i<itmsLen; i++){

    curItem = itms;

    If(curItem instanceof CompItem){

    If(curItem.name == “your comp name”){ //Will grab only the first name match

    myComp = curItem;

    break;

    }

    }

    }

    var chkLayer = myComp.layer(“Layer Name”);

    if (chkLayer == undefined){

    //do this

    }else{

    //do that

    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy