8 Replies Latest reply on Aug 1, 2013 12:22 PM by tlumbis

    Deleting all empty layers except for one?

    tlumbis Level 1

      Hello,

       

      This script deletes all empty/blank layers. I need it to delete all empty/blank layers except for the layer that is named "Grid".

      I've tried searching the forum for clues but I'm stumped. Any help would be greatly appreciated.

       

      Thank you much.

       

      var myLayers = app.activeDocument.layers.everyItem().getElements();

      for(var i=myLayers.length-1;i>=0;i--){

      if(myLayers[i].pageItems.length==0){

      myLayers[i].remove();

      continue;

      }

      }