Forum Replies Created

  • Mahmoud Elsafy

    July 28, 2021 at 3:09 pm in reply to: CEP Panel: Event Listener Layer Selection

    Main .jsx

    function getSelectedLayer() {

    SL = app.project.activeItem.selectedLayers;

    //return selected layer index or any other property

    return SL.length != 0 ? SL[0].index : null

    };

    
    

    main .js in HTML

    var csInterface = new CSInterface();

    setInterval(() => {

    csInterface.evalScript(“getSelectedLayer()”, function (result) {

    if (result !== “null”) {

    //Do something when layer is selected

    $(‘#elemID’).html(‘Selected Layer index: ‘+ result);

    }

    });

    }, 1000); // checks selected layer every one second

    
    
    		

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy