1 Reply Latest reply on Jun 6, 2017 3:26 AM by c.pfaffenbichler

    Access a Layer inside a Group

    TeaGirlVn

      So I have something like this:

       

      var myDocument = app.activeDocument;

      var theLayerA = myDocument.artLayers.getByName("A");

       

      All I want is access to a layer named "A" in the active document, it works fine if that layer "A" is not in a Group. But if it's in a Group, I'll get the message "no such element".

       

      I searched around this forum, someone showed a way to access a certain Layer inside a certain Group, but with that method I need to know the name of that Group. The thing is, I'm using this scripts for diffrent psd files, and in each psd files, layer "A" stays in diffrent groups ( or not in a group at all ).

       

      Is there a way to find layer A no matter what group it is in ?

       

      I'm sorry for my English, please forgive me if my way of asking is impolite.

       

      Thank you very much.