I have created an action that runs the following script:
// Deletes layer "8 Page" in all open documents...loop through all open documents
var layersDeleted = 0;
for ( i = 0; i < app.documents.length; i++ ) {
var targetDocument = app.documents;
var layerCount = targetDocument.layers.length;
// Loop through layers from the back, to preserve index of remaining layers when we remove one
for (var ii = layerCount - 1; ii >= 0; ii-- ) {
targetLayer = targetDocument.layers[ii];
var layerName = new String( targetLayer.name );
if ( layerName.indexOf("8 Page") == 0 ) {
targetDocument.layers[ii].remove();
layersDeleted++;
}
}
}
However when I save this as an action and restart illustrator...and run the action I created I get the following error:
"Some event has not been registered for action"
and my action/script doesn't do what it is supposed to.
Any help would be greatly appreciated!!