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

Counting Layer Comps

New Here ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

I'm finally up and running with a basic skeleton of code. I've counted the number of layers (using keyNumberLayers) in a document, etc.

Now I'm stuck again-- I'm trying to count the number of Layer Comps. I thought this would be something easily available in classDocument, but I don't see any such thing.

How would someone go about doing this?
TOPICS
SDK

Views

443

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
Adobe
New Here ,
Feb 01, 2007 Feb 01, 2007

Copy link to clipboard

Copied

Using javascript, this can be done with:

val = app.activeDocument.layerComps.length

Is there a way to get to this app global when making an automation plugin?

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
Adobe Employee ,
Feb 15, 2007 Feb 15, 2007

Copy link to clipboard

Copied

See the Getter automation plug-in example. This shows you all the information you can 'get' from Photoshop. There is also the properties suite but for layer comps you want to look at Getter.

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

Copy link to clipboard

Copied

LATEST
Tom,

Could you elaborate on the Properties suite you mentioned?

I need to get rather basic info from all layers in a given document - like it's name, but I find iterating through a document with about 50 layers seems to take about 5 seconds, and I'm probably going to need to handle documents with hundreds of layers.

I use the following code in a loop to get the info I need:

PIUGetInfoByIndexIndex(layerIndex, docIndex, classLayer, classDocument, keyName, name, &nameLen);

Is there a faster way or some lighter weight routine which I can use? I adapted my code from the Getter example.

The only reference to the properties suite I found was the SPProperties Suite which seemed to deal with Plugin properties, not document properties.

On a related note, I also need a list of selected layers - the only way I know is to
1) save layer visibility state
2) make all layers invisible
3) make selected layers visible (since this can be done through an API call)
4) loop through layers, the visible layers are the selected layers
5) restore layer visibility
This is a technique used in one of xbytor's scripts.

Is there a faster way? I'm anticipating a massive delay here - as I'm actually going to have to ask PS to change layer visibility *two* times in addition to obtaining layer information, which already takes too long.

Any assistance or suggestions appreciated,
Brian.

P.S I apologize for not starting a new topic, I found my questions complimentary to this thread; if inappropriate, I can post again.

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