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

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

Contributor ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

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

Views

116

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

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

Votes

Translate

Translate
Community Expert , Nov 26, 2024 Nov 26, 2024

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

Votes

Translate

Translate
Adobe
Participant ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

LATEST

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

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