Skip to main content
Participant
December 8, 2017
Answered

Illustrator Actions - Pop Up 'Yes or No' stopping Action

  • December 8, 2017
  • 4 replies
  • 989 views

Hello!

I'm trying to run an action on a batch of illustrator files.

The action involves deleting a layer, but the layer contains artwork so an Illustrator warning message always pops up saying:

"LayerName contains artwork. Do you want to delete this layer?" with a Yes or No response required. This stops the action running and requires me to click yes or no every single time. The response is always yes, so can I make the action click yes and continue with the rest of the action?

Thanks!

This topic has been closed for replies.
Correct answer Ton Frederiks

You can record an action that plays a script that deletes a selected layer.

Like this script. Copy and paste it in a plain text file and save it with the .jsx extension in the Illustrator Presets Scripts folder.

//Based on a script found here: https://forums.adobe.com/message/7446190#7446190

//

try { 

    app.activeDocument.activeLayer.remove(); 

} catch (e) {};

4 replies

Ton Frederiks
Community Expert
Community Expert
December 8, 2017

I see that you want to Batch the Action.

That probably means that the name of the layer is fixed.

In that case use the script from the post I referred to in my previous message..

Ton Frederiks
Community Expert
Ton FrederiksCommunity ExpertCorrect answer
Community Expert
December 8, 2017

You can record an action that plays a script that deletes a selected layer.

Like this script. Copy and paste it in a plain text file and save it with the .jsx extension in the Illustrator Presets Scripts folder.

//Based on a script found here: https://forums.adobe.com/message/7446190#7446190

//

try { 

    app.activeDocument.activeLayer.remove(); 

} catch (e) {};

Mike_Gondek10189183
Community Expert
Community Expert
December 8, 2017

Apologies if you already know this or have an alternate method, but wanted to share as this may help.

Copy to your clipboard any object that is on the correct layer name. Make sure paste remembers layers is enabled. In your action add a paste command at the beginning, then delete layer. Since the layer name is not recorded but the selected layer, the paste takes you to the correct layer.

As far as getting rid of the dialog, I do not know but wish this was possible. Not even running as batch and logging errors to file will help.

Monika Gause
Community Expert
Community Expert
December 8, 2017

Is it possible to first delete the objects?

Can you securely select them (without risking toselect something else)?

Then using Select > Same > On same layer and delete?