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

Recording Delete Hidden Layers in an Action (Illustrator)

Engaged ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

I have a series of Illustrator AI files, some with hidden layers that I need to delete.

 

I can use the Delete Hidden Layers command within the Layers panel to remove them all, manually.

 

However, this command is not recordable as an Action.

 

I can record "Unlock All Layers." (Many of my layers are also locked.) In the Actions panel, it shows as:

>Show:

   Unlock All Layers

 

When I try to record "Delete Hidden Layers," it's recorded in the Actions panel as:

>Show:

   Name:

 

This step of the action just creates a new Layer (and prompts me to name it).

 

I've also tried "Insert Menu Item" from the Actions panel, but it appears menu items from panels are not included in that option.

 

Is it really just impossible to perform this menu function without resorting to writing code?

 

Why are so many of Illustrator's commands and menu items not actionable?

TOPICS
Bug , Feature request , How-to , Scripting , Tools

Views

125

Translate

Translate

Report

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 ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

You are right that the implementation of the Delete Hidden Layers command in the Actions palette is nonsense, just as the command itself (strictly speaking) because it also deletes objects and not just layers.

 

Currently, you'd indeed have to resort to creating a script for that task. I've created one that does delete empty, locked, hidden or non-printing main layers and sublayers. Currently it does not delete hidden objects. Let me know if that may help you and I'll post a download link.

 

As for your question: Why are so many of Illustrator's commands and menu items not actionable?

 

The answer is pretty simple and disappointing: It's because for many years Adobe has lost sight of implementing many commands as actionable commands.

 

About ten years ago, there was an official announcement indicating that the entire actions architecture was going to be revamped. Unfortunately, it was kicked into the long grass.

Votes

Translate

Translate

Report

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
Engaged ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

Thanks, Kurt, I was hoping to avoid scripting. (I need something that's easy to maintain and adapt — and also deploy to a user base that doesn't have admin rights to install things like scripts into the application folder.)

 

I've seen a few scripts for doing this — and for the record, I'm OK with deleting anything that isn't visible. The adjustments I'm making for color (like making them grayscale) require selecting them first, and I can't do that if they're not visible. This leaves objects in a state I don't want (e.g. color) still in the file.

 

Illustrator is like InDesign, in that you have multiple objects inside layers, each with their own visibility. Photoshop's layers are all individual objects.

 

Photoshop's command to Delete Hidden Layers works differently, in that you can have a layer group that has the visibility turned off, while objects inside the group still have their individual visibility set to on. (The layers are invisible, because the parent layer group is invisible.) 

 

I have a script that selects all the visible layers in Photoshop. It selects layers that are not visible because the layer attributes themselves are set to "on" while the layer group they're in is set to "off." So while the script technically doesn't work (selecting invisible layers) the Delete Hidden Layers command in Photoshop will delete these layers, because it deletes hidden layer groups — even if the contents of those groups are still set to "visible."

 

Which is the correct order of operations in that scenario? It's subject to the objective, I guess.

 

Edit: oh, and for the record, "Delete Hidden Layers" in Photoshop is both recordable and insertable with the "Insert Menu Item" command in the panel.

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

Thanks for the clarification.

If it has to be an action or if it is just the preferable approach, it may be done in some way.

 

Can you share a couple of Illustrator files you're going to process with an action that would delete anything that is invisible?

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

The problem can be partially, though unfortunately not completely, circumvented.

(Empty layers remain in the document, but all hidden objects are deleted.)

 

You can try to go the opposite way:

pixxxelschubser_0-1714078328420.png

 

That means:
at first: tick on: Paste remember layers

action name: Delete hidden

  • layer command: unlock all layers
  • select all
  • cut
  • layer command: all layers visible
  • unlock all
  • all visible
  • select all
  • delete
  • paste in place

 

Votes

Translate

Translate

Report

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
Engaged ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

that's a very interesting workaround. The simplest solutions are usually best.

 

Here's my only concern (and one that would need testing): if two items, same layer or different, were interacting with each other with effects or blending modes (clipping masks, etc.), would cutting them out of the document and then pasting them back in preserve all of that? Would those interactions between objects remain through a cut and paste?

Votes

Translate

Translate

Report

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
Community Expert ,
Apr 25, 2024 Apr 25, 2024

Copy link to clipboard

Copied

LATEST

Considering all possible special cases was one reason why I asked for some Illustrator sample files, so one can inspect what action approaches are realistic or what else has to be done to make them work.

Votes

Translate

Translate

Report

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