1 Reply Latest reply on Nov 22, 2011 9:37 PM by John Hawkinson

    3 layers in my document

    kerosk_inddNew

      Hi All,

       

      I have 3 layers in my document. Layer0 is text layer, Layer 1 is graphic layer and layer 2 is color box layer.

       

      Can I check all my 3 layers items and save a report if there is any item placed in wrong layer?

       

      Layer0 assigned for all text.

      Layer1 assigned for all graphic.

      Layer2 assigned for color boxes.

       

      Thanks,

      Kerosk

        • 1. Re: 3 layers in my document
          John Hawkinson Level 5

          Sure. To get you started:

           

          var layer0=app.activeDocument.layers.itemByName("Layer0");
          if (layer0.rectangles.length) {
            alert("Layer0 contains "+layer0.rectangles.length+" rectangles.");
          }
          

          Of course, it turns out that while text items are .textFrames and boxes are .rectangles, graphics are .rectangles, too.

          Fortunately you can use .allGraphics array which is a property of the layer.