Photoshop: Scripting: Does the ID of the layer stays with it forever, even after closing Photoshop?

  • 1
  • Question
  • Updated 3 years ago
  • (Edited)
Hi,

I need to write a script for extension and I have to be 100% sure the ID of the layer in PS CC2014 stays with it forever, even after closing Photoshop.
Photo of Paweł Magiera

Paweł Magiera

  • 13 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14049 Posts
  • 1735 Reply Likes
Layer ID's are only valid at runtime.

You could look at per layer XMP data for setting your own stable identifier.

What is the use case/workflow you are trying to achieve.
Photo of Paweł Magiera

Paweł Magiera

  • 13 Posts
  • 0 Reply Likes
I'm setting something over per layer XMP. Then I have to change something with layer that has specific XMP, but how do I know which layers have my XMP data. At first I though about looping through layers to check which layer has XMP set and then save ID of layers for runtime, but it's slow and opens each group. So how could I get layers that has my specific XMP?
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14049 Posts
  • 1735 Reply Likes
Could you set the info at the document XMP level (which layers have XMP) and use that to go to the correct layer?
Photo of Paweł Magiera

Paweł Magiera

  • 13 Posts
  • 0 Reply Likes
But how do I describe which layer, when I can't use id?
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14049 Posts
  • 1735 Reply Likes
Custom layer name prefix/suffix?
Photo of Paweł Magiera

Paweł Magiera

  • 13 Posts
  • 0 Reply Likes
I can't do that since I'm making an extension for other people. When I know ID I can make layer active by ID and then change something to it. With name I have to probably loop through all layers to find it. Is there a way to iterate through layers faster than DOM, which also doesn't open each group?