Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to find the selected layer index number?

  • How to find the selected layer index number?

    Posted by Palak Bhatt on July 23, 2020 at 9:16 pm

    Does anyone have the idea
    How to find the Index number of current or selected layer

    How to find the ID or number of my selected layer?

    Please help

    var i = app.project.item(index).layer(index);

    Palak Bhatt replied 6 years ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    July 23, 2020 at 9:52 pm


    if (app.project.activeItem.selectedLayers.length>0) {
    var i = app.project.activeItem.selectedLayers[0].index;
    }

    There can always be more than one layer selected, so selectedLayers is always an Array, it could be an empty error, so first check for the length or it might throw an error

  • Palak Bhatt

    July 24, 2020 at 8:15 am

    Love you so much. Thank you
    Its worked like a charm.. Very Glad

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