How to delete layer by name?
Hello,
I currently have a script that deletes unused/blank/empty layers:
var layers = app.activeDocument.layers.everyItem().getElements();
for(var i=layers.length-1;i>=0;i--){
if(layers.pageItems.length==0){
layers.remove();
}
}
but in addition to unused layers, I need it to delete layers which have a layer name that begins with a bracket "[". Often there are template layers in our workflow which are not needed - they are named differently but always begin with a bracket. Example: [page 2] xxx-xxx-####
I've tried frankensteining in a piece of code that Jarek provided for another script which dealt with swatch names but I'm afraid I'm rather hopeless (I am planning on becoming less hopeless... so maybe you won't always be overcome with dread upon seeing my posts... but that doesn't solve my (or your) problem now).
As always, I appreciate your consideration and help.
