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

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

Engaged ,
Nov 26, 2024 Nov 26, 2024
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);
}

 

TOPICS
Scripting
174
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

correct answers 2 Correct answers

Participant , Nov 26, 2024 Nov 26, 2024

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
Community Expert , Nov 26, 2024 Nov 26, 2024

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

Translate
Participant ,
Nov 26, 2024 Nov 26, 2024

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
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 ,
Nov 26, 2024 Nov 26, 2024
LATEST

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

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