1 Reply Latest reply: Aug 4, 2013 9:09 AM by Dominik Guzei RSS

    Getting LayerID of CSAW layer instance

    Dominik Guzei Community Member

      Hey there,

      Since the CSAW API to manipulate layers etc. is pretty limited I need to work with the magic of ActionManager to achieve most of my functionality.

      The problem is, there doesn't seem to be any "bridge" between those two interfaces. I can do stuff in the world of ActionManager by composing cryptic commands but I currently see no way to say "this com.adobe.photoshop.Layer (CSAW) instance belongs to this LayerID / index (ActionManager)".

       

      If there is any way to connect these two worlds please tell me, its really frustrating that I have to write every layer manipulation with ActionManager just because there is no property "id" for the class com.adobe.photoshop.Layer!

        • 1. Re: Getting LayerID of CSAW layer instance
          Dominik Guzei Community Member

          Ok I maybe found at least a way to connect both worlds.

           

          You have to iterate through all layers (by index) and do the following steps:

           

          • make the layer at given index active via ActionManager
          • Get a reference to that layer via the DOM (activeDocument.activeLayer)
          • Get the layerID of the active layer with the ActionManager
          • Save the layerID and DOM layer instance somewhere together (e.g, a model class)

           

          Most parts of that solution can be found in this discussion:

          http://forums.adobe.com/message/2666611

           

          hope this maybe helps someone!