2 Replies Latest reply on Nov 30, 2015 9:07 AM by williamadowling

    How do I access the art-tree for a particular layer?

    wideEyedPupil Level 1

      when I use

      targetLayer = sourceDoc.layers [i];

      msg += targetLayer.length + '\r';

       

      I get undefined returned for targetLayer.length

       

      var msg = "List of visbile layers\r"

      // a work in progress towards a script to count objects on all visible layers and return a list with sub-totals and  grand-total

       

      // If a docuement is open

      if ( app.documents.length > 0 ) {

          sourceDoc = activeDocument;

          if(sourceDoc.pageItems.length > 0 ) {

              var layerCount = sourceDoc.layers.length;

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

                  targetLayer = sourceDoc.layers [i];  

                  objectsOnLayer =

                  if (targetLayer.visible ) {

                      msg += targetLayer.name + '  ';

                  }

                  msg += targetLayer.length + '\r';

           }

      alert (msg +"\r i =" + i, -1)

      }

      }