Skip to main content
DBarranca
Brainiac
February 21, 2014
Question

com.adobe.csxs.events list

  • February 21, 2014
  • 2 replies
  • 11514 views

Hello,

is there a list of Panel's related (minimized, closed, iconized, moved, resized, etc) events that are supported so far?

 

Thank you

 

Davide Barranca

 

(Link removed)

 

 

    This topic has been closed for replies.

    2 replies

    Hallgrimur Bjornsson
    Inspiring
    April 8, 2014

    Does the list here not help? : http://adobe.ly/1cWBggl

    DBarranca
    DBarrancaAuthor
    Brainiac
    April 8, 2014

    Hallgrimur,

    you read my mind - I was exactly on that PDF!

    Besides:

    • documentAfterActivate,
    • documentAfterDeactivate,
    • documentAfterSave,
    • applicationBeforeQuit,
    • applicationActivate

    which are about the host app and its open documents (say Photoshop and an open image), talking about strictly Panel's stuff, there's only the possibility to RegisterExtensionUnloadCallback() - that is, before the extension closes, am I right? No resize / collapse events if I understand correctly (to my needs the unload is enough).

    Also, do I get it right that GetWorkingDirectory(), IsRunning(), OnQuit(), they all refer to Processes - that is external commands such as "ls" in the terminal - and not the extension (the panel) itself?

    Thank you!

    Davide

    ----

    UPDATE

    As a side note, it's not clear from the CC_Extension_SDK.pdf that we should use it like "window.cep.category.method", where category is either fs, process, util, encoding. You get it if you inspect the source code.

    September 10, 2017

    Hi Hallgrimur,

    This code is not working for me either (Photoshop CC 2014 host on Windows 8 x64).

    Is there an alternative for catching the event when the extension is being closed by the user that we can use?

    Arturo.


    As of 2017 I also need to catch the close panel event to make same safety checks on the document right before the extension is unloaded.

    I hope the event "com.adobe.csxs.events.ExtensionUnloaded" is going to work some day on panels, because it seems to be predestined for the purpose. But I found a workaround so far which is tested on Photoshop CC 2017 / MacOS, CSXS v. 7.0

    You can use "com.adobe.csxs.events.WindowVisibilityChanged". It just fires on persistent panels in my attempts. Here's the main.js to test panel visibility (opening/closing the panel) and ExtensionUnloaded (doesn't fire at all):

    (function() {

        'use strict';

        var fs = require('fs');

        var csInterface = new CSInterface();

        var gExtensionId = "YOUR_EXTENSION.extension";

       // activate persistence

        var persistence = new CSEvent("com.adobe.PhotoshopPersistent", "APPLICATION");

        persistence.extensionId = gExtensionId;

        csInterface.dispatchEvent(persistence);

        console.log('panel window events:');

        /* activate document event: working on both persistent and non-persistent panels */

        new csInterface.addEventListener("documentAfterActivate", function(event) {

            console.log('activated doc: ' + event.data);

        })

        /* collapse/open panel: just working on persistent panels */

        new csInterface.addEventListener("com.adobe.csxs.events.WindowVisibilityChanged", function(event) {

            console.log('window visibility: ' + event.data);

            fs.writeFile("/Users/OSX_USERNAME/Desktop/visibilitychanged.txt", 'visibility changed', function(err) {

                if (err) { console.log(err); }

            });

        });

        /* unload panel: not working at all on panels */

        new csInterface.addEventListener("com.adobe.csxs.events.ExtensionUnloaded", function(event) {

            console.log('extension unloaded: ' + event.data);

            fs.writeFile("/Users/OSX_USERNAME/Desktop/unloaded.txt", 'extension is unloaded', function(err) {

                if (err) { console.log(err); }

            });

        });

    }());

    If you want your panel to be non-persistent here's a workaround, which is not a beauty but it works.

    Just set the "PhotoshopUnPersistent" flag when collapsing the persistent panel:

      /* workaround for "ExtensionUnloaded" by toggling persistence */

        new csInterface.addEventListener("com.adobe.csxs.events.WindowVisibilityChanged", function(event) {

            console.log('window visibility: ' + event.data);

            fs.writeFile("/Users/OSX_USERNAME/Desktop/visibilitychanged.txt", 'visibility changed', function(err) {

                if (err) { console.log(err); }

            });

            var unPersistence = new CSEvent("com.adobe.PhotoshopUnPersistent", "APPLICATION");

            unPersistence.extensionId = gExtensionId;

            csInterface.dispatchEvent(unPersistence);

        });

    (remember to adjust the extension name and path on writeFile - but logging suffices)

    The workaround assumes that the panel is set to persistent on start. I could verify that persistence actually switches with some status flags in the html/js file.

    ---

    related links:

    a (closed) Github issue on "ExtensionUnloaded" - hope it will come to panel extensions, too:

    ModalDialog: how to hide the close button or get unload event · Issue #77 · Adobe-CEP/CEP-Resources · GitHub

    Re: What event type is fired when the panel is collapsed ?

    com.adobe.csxs.events list

    DBarranca
    DBarrancaAuthor
    Brainiac
    April 8, 2014

    Bump!