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

[Renamed] Scripting - Hide the first object in layer "Artwork"

Community Beginner ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Hi,

with jsx script, how do I access first object in layer named "Artwork".

Something like:

var doc = app.activeDocument;
var item = doc.layers['Artwork'];
item.pageItem[0].visible = false;

 

but thats not it obviously

 


[ title changed by moderator ]

TOPICS
Scripting

Views

255

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

Community Expert , Mar 12, 2021 Mar 12, 2021

Hi,

It should be pageItems instead of pageItem in the following line

item.pageItem[0].visible = false;

 

Another question, what do you mean by first Item, is it one visible at the top inside the layer or at the bottom?

Secondly, visible is not the property to change teh visiblity. Property name is hidden.

So try following snippet to hide the first item

var doc = app.activeDocument;
var item = doc.layers['Artwork'];
item.pageItems[0].hidden = true;

Votes

Translate

Translate
Community Expert , Mar 12, 2021 Mar 12, 2021

Try:

var doc = app.activeDocument;
var aLay = doc.layers['Artwork'];
aLay.pageItems[0].hidden = true;

 

But I would use pathItems[0] instead.

Votes

Translate

Translate
Adobe
Community Beginner ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

sorry about the misleading title, I forgot to change it

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 ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Hi,

It should be pageItems instead of pageItem in the following line

item.pageItem[0].visible = false;

 

Another question, what do you mean by first Item, is it one visible at the top inside the layer or at the bottom?

Secondly, visible is not the property to change teh visiblity. Property name is hidden.

So try following snippet to hide the first item

var doc = app.activeDocument;
var item = doc.layers['Artwork'];
item.pageItems[0].hidden = true;
Best regards

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 ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Try:

var doc = app.activeDocument;
var aLay = doc.layers['Artwork'];
aLay.pageItems[0].hidden = true;

 

But I would use pathItems[0] instead.

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 ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

two souls - one thought

😉

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 Beginner ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

LATEST

At the top inside the layer.

Thank you, it works

Have a nice day

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