Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Action running a script

New Here ,
Nov 06, 2008 Nov 06, 2008
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!!
TOPICS
Scripting
493
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Nov 06, 2008 Nov 06, 2008
LATEST
Illustrator does not remember scripts in actions on restarts. It has been this way for at least 4 versions. You will have to remake the action on each restart.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines