Skip to main content
ThinkingThings
Inspiring
January 17, 2015
Question

What is the FASTEST way to identify colors used on a layer?

  • January 17, 2015
  • 2 replies
  • 1506 views

Hi All,

Is there any "faster" way to identify colors used on a given layer other than to iterate through the layer's pageitems?  I am optimizing a few scripts and am looking to squeeze milliseconds as a layer with a lot of pageitems can take a while (relatively speaking of course). 🙂  Any perspectives would be appreciated.

All the best!!

-TT

This topic has been closed for replies.

2 replies

Disposition_Dev
Legend
January 27, 2015

ThinkingThings I actually just built a script to do this very task. For my purposes, i was duplicating the page items onto a new layer.. but you don't need to.

The you can use the document's inkList. If you're seeking a specific layer, you can simply set the property 'printable' to false for all other layers. then redraw() and then return the inkList colors whose printStatus == PrintingStatus.ENABLEINK. (only the target layer's colors will be displayed since any colors from a (printable = false) layer will be disabled in the inkList.

if you need to return the colors from each layer, you can just throw the whole function into a for loop to cycle through the layers.

Sorry, i know that was a really brief description, but it works great and is VERY fast. Let me know if you have any questions.

Silly-V
Legend
January 27, 2015

William, your script only works for ink plates, which is fine if your only concern is spot colors, or ink plates, but his may be a different use where he wants to gather actual color process numbers or non-spot swatch names.

Disposition_Dev
Legend
January 27, 2015

Well played Vasilly. Well played.

CarlosCanto
Community Expert
Community Expert
January 17, 2015

Hi TT

- select all in layer

- create a new swatch group

- get swatches in group

just a thought, not tested.

ThinkingThings
Inspiring
January 18, 2015

Hey Carlos,

I haven’t been able to figure out how to create a new swatch group using selected items (of the document) without using the UI. Am I missing something?

Thanks,

-TT

CarlosCanto
Community Expert
Community Expert
January 18, 2015

are you on CS6 or newer? record an action to create a new swatch group, then play such action with javascript using app.doScript('actionName', 'setName')