Photoshop: UID per layer/layerSet

Is there any property on a layer or layerSet that can hold an arbitrary string? The only thing i can find is name, but artist can and will change this, thus trivializing the UID concept :slight_smile:

I’ve read through the scripting PDF and can’t really find any property that fits the bill so I was hoping for some clever/hidden solution to this.

Thanks

I don’t know about annotation for layers, but I know the document has annotation properties.

Go File -> File Info…

If it’s something you don’t do often, then I think this will work.

docRef = app.activeDocument;
docRef.info.author = "shawn kirsch";

Yeah i have given up. There nothing on the layers aside from name. The file info is great for document level stuff, but i needed something per layer. Not a big deal though

It depends how often you’re computing something, you could possibly use tuple values inside the doc level that refer to layerID’s…

[[LayerSet 34, “Layerstyle = Multiply”],[ArtLayer 12, “Layerstyle = Normal”]]

Also I’d post this on http://www.ps-scripts.com/bb/. Mike runs the site and he normally answers questions each day.

When do you need to assign/read the UID?
You could generate them at export time (if that makes sense for your situation) based on their position in the array of Layers

if you have a small enumerable set of artists.

you could also - though this might be evil – force named groups/folders as containers

layer.textItem.contents might be defined even when layer.kind is not LayerKind.TEXT. I have not tried this.

And document.info.keywords is an array of strings, so – a bit awkwardly – you could have a per-layer list of name:author pairs in there (or author:layer/layer/layer… which might be better)

Oh, and btw to get the username:

var userName = Folder('~').fsName.match(/[^\\]+$/);

Finally found it. And to think it’s been in there since 08!
http://blogs.adobe.com/jnack/2008/10/per-layer_metadata_comes_to_photoshop.html

It event gives you timestamps on the layers :slight_smile:

thanks for the post!