1 Reply Latest reply on Jun 14, 2016 1:29 AM by Heimdaal

    Layer select -event listener using CSEvent

    Heimdaal Level 1

      I read Davide's intro to Photoshop event listeners using the CSEvent class:

      HTML Panels Tips: #7 Photoshop Events, Take 1 | Photoshop, etc.


      And long story short: I got things working but I can't seem to make an event trigger on a layer selection.

      Using the charID "slct" makes the event fire when using any of the selection tools (polygon lasso, magic wand, etc) but not when selecting layers.


      I found some related threads:
      artLayer selected event?

      Is there any event listener for changing the selection of layer?


      ...but in neither case are they working with CSEvent.
      If I understand this correctly, I need to provide additional parameters to my event.data before dispatching the event with csInterface.dispatchEvent(event) - but how?



          'use strict';
          var csInterface = new CSInterface();
          var event = new CSEvent("com.adobe.PhotoshopRegisterEvent", "APPLICATION");
          event.extensionId = "com.example.psevents";
          event.data = "1936483188"; // charIDToTypeID("slct") - which is "select"
          function init(){
              // code
          function PSCallback(csEvent){
              alert("it works!");
          csInterface.addEventListener("PhotoshopCallback", PSCallback);