Skip to main content
Inspiring
Nov 26, 2024 4:16 PM UTC
Answered

Skip hidden, locked, and objects from hidden and locked layers

When processing objects that were retrieved as 'doc.pathItems' I skip the ones that are
- hidden
- locked
- are on a hidden layer
- are on a locked layer
However, the script still tries to process an object that is on a hidden layer, and gives an error when it does a 
item.selected = true; // inside of pasteSubtractOn()
 

 

if (!item.locked && !item.hidden && !item.layer.locked && !item.layer.hidden){
    pasteSubtractOn(item);
}

 

This topic is closed to new replies. Start a new post to keep the conversation going.
sttk3Correct answer
Legend
Nov 26, 2024 8:42 PM UTC

A simpler way to achieve this is to examine item.editable.

2 replies

sttk3Correct answer
Legend
Nov 26, 2024 8:42 PM UTC

A simpler way to achieve this is to examine item.editable.

Translate
RobOctopus
Inspiring
Nov 26, 2024 4:20 PM UTC

Layers do not have a hidden property, they are visible 

https://ai-scripting.docsforadobe.dev/jsobjref/Layer.html#layer-visible

I would wager this is the problem

Translate