Read Layer's Color Label

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

activeDocument
Posts: 1
Joined: Thu Sep 01, 2016 3:36 pm

Read Layer's Color Label

Post by activeDocument »

Hello,

I started writing PScripts this very day coming from a 15+ Years Background in Flash/ActionScript Development and FrontEnd/JS Programming.
After extensive searching both in the Script Reference and other Documentation I was unable to confirm wether or not its possible to at least retrieve a layers color label (Red, Orange, Yellow, None etc) given by the Author in the Layer Panel.

This would be extremely useful.

Thanks for any hints

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

pixxxelschubser
Posts: 26
Joined: Mon Aug 01, 2016 8:59 pm

Re: Read Layer's Color Label

Post by pixxxelschubser »

Hi,
you can try this one:

Code: Select all

var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
alert ( typeIDToStringID(desc.getEnumerationValue( stringIDToTypeID('color')) ));
Have fun
;)
Dimatokis
Posts: 11
Joined: Wed Aug 17, 2016 7:50 pm

Re: Read Layer's Color Label

Post by Dimatokis »

Thank you! Useful!

Green label returns 'grain' :)