Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I simply add a class to a layer in Photoshop CS5? That class should hold properties like "fill color", "size", etc.

I'm very new to scripting Photoshop so please bear with me =)


share|improve this question

migrated from Jul 24 '11 at 10:13

This question came from our site for professional and enthusiast programmers.

I read the title and I'm thinking, "Gee, I've never worried about my layers not being classy enough. Maybe a snappy hat and a nice tie?" – Lauren Ipsum Jul 24 '11 at 14:08
up vote 4 down vote accepted

You don't. The classes that are provided by the applications you are working with aren't extensible. But, what you can do to get around this is to create a record making use of Applescript's dynamic typing.

set myLayerInformation to {layer:psLayerObj, fill color:fillColorObj, width:mWidth, height:mHeight}
set targetLayer to layer of myLayerInformation
-->RESULT: psLayerObj

The records, in turn, could be held in a list that you can maintain along side the layers. It isn't elegant, but it should get the job done.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.