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

Grab graphic layer option by item name

New Here ,
Aug 21, 2013 Aug 21, 2013

Copy link to clipboard

Copied

Hello,

I can easily acess a graphic's layer option by using the following:

var doc = app.activeDocument.allGraphics;

doc[0].graphicLayerOptions.graphicLayers.itemByName( "Orange").currentVisibility = true;

Instead of "doc[0]", I would like to grab the graphic by the name/label it has as a item in the layers menu: "Bee".

var test =  app.activeDocument.pageItems.item("Bee");

I get confused, as one is a pageItem and the other a graphic and I'm not good enough in scipting to understand the whole hirachy.

Can someone help?

Thanks alot,

Kosta

TOPICS
Scripting

Views

574

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
Enthusiast ,
Aug 21, 2013 Aug 21, 2013

Copy link to clipboard

Copied

Hi,

name in layers palette is always a reference to a page item.

Assuming only one image / graphic in it you can access it by

var test =  app.activeDocument.pageItems.itemByName("Bee").graphics[0];

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
New Here ,
Aug 21, 2013 Aug 21, 2013

Copy link to clipboard

Copied

Hmmm,

if I try this:

app.activeDocument.pageItems.itemByName("Bee").graphics[0].graphicLayerOptions.graphicLayers.item("Orange").currentVisibility = true;

ID tells me that graphics does not support this method or properties.

Is my thinking wrong?

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
Enthusiast ,
Aug 21, 2013 Aug 21, 2013

Copy link to clipboard

Copied

LATEST

your codeline should work as long as you've got a single page item (attention: you can't access the page item by name if it is part of a group) named 'Bee' and the graphic includes a layer 'Orange'

checkItOut.PNG

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