0

As the title says, I would like to know if and how my CEP extension can listen to Select event, but only for historyState and not when I just select a layer for example. Here is an example how my extension listens to select event...

JS

(function()
{
    'use strict';

    var csInterface = new CSInterface();

    function Register(inOn)
    {
        if (inOn)
        {
            var event = new CSEvent("com.adobe.PhotoshopRegisterEvent", "APPLICATION");
        }
        else
        {
            var event = new CSEvent("com.adobe.PhotoshopUnRegisterEvent", "APPLICATION");
        };
        event.extensionId = "my_extension_id";

        // #region // EVENT CODES //
        // ╔════════╦═════════╦════════════╗
        // ║ Name   ║ Char ID ║ Type ID    ║
        // ╠════════╬═════════╬════════════╣
        // ║ Hide   ║ Hd      ║ 1214521376 ║
        // ║ Select ║ slct    ║ 1936483188 ║
        // ║ Set    ║ setd    ║ 1936028772 ║
        // ║ Show   ║ Shw     ║ 1399355168 ║
        // ╚════════╩═════════╩════════════╝
        // #endregion

        event.data = "1936483188";
        csInterface.dispatchEvent(event);
    }

    function init()
    {
        themeManager.init();
        $('#registerEvent').change(function()
        {
            Register($(this).is(':checked'));
        });
    };

    function PSCallback(csEvent)
    {
        var dataArray = csEvent.data.split(",");
        csInterface.evalScript('convertTypeID(' + JSON.stringify(dataArray\[0\]) + ')', function(res)
        {
            $('#result').val(res.toString());
        });
    };

    init();
    csInterface.addEventListener("PhotoshopCallback", PSCallback);
}());

JSX

function convertTypeID (typeArray)
{
    return typeIDToStringID(Number(typeArray));
};
  • 2
    I feel this is more of a "development" question than a design question. Most graphic designers are not deep into extension writing. – Scott Nov 8 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.