Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Counting specific layers from above the current layer?

  • Counting specific layers from above the current layer?

    Posted by Kyung Ko on February 4, 2020 at 11:44 pm

    Hello,

    I have many text layers mixed with the other type of layers, and the main text layer, L1 is in the middle.
    So basically I would like to count the number of text layers that include “title” in the text field only from the layers above the L1 layer and print it out to L1 layer.

    Thanks for your help! 🙂

    Kyung Ko replied 6 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 5, 2020 at 12:30 am

    Something like this should work:


    count = 0;
    for (i = 1; i < index; i++){
    L = thisComp.layer(i);
    try{
    if (L.text.sourceText.value.indexOf("title") > -1) count++;
    }catch(e){
    }
    }
    count

    Dan

  • Kyung Ko

    February 5, 2020 at 3:08 pm

    Thanks so much Dan!! This solved the problem I tried to get for hours.

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