Skip to main content
Inspiring
August 2, 2019
Question

Panel close event or click 'x' icon in top left

  • August 2, 2019
  • 2 replies
  • 1206 views

Hi All,

I have created the panel. Now I want to call the function when user click 'x' icon in top left side of panel.

I'm using Indesign CC 2018

How can I call using CSEvent or any event listener?

Please give any helps!!

thanks,

John.

This topic has been closed for replies.

2 replies

Inspiring
November 22, 2023

Hi @Manan Joshi , I want to do the same. I use this script but the function execute after close the panel but I want to close the panel after my function.


(function() {  

  'use strict';  

  var csInterface = new CSInterface();  

  var keepAlive = new CSEvent("com.adobe.InDesignPersistent", "APPLICATION");  

  keepAlive.extensionId = "com.adobe.ImportExport.panel";  

 
  new csInterface.addEventListener("com.adobe.csxs.events.panelWindowVisibilityChanged",

  function(event) {  

    alert('Window Visibility1: ' + event.data);  
   
  }
 
  );  
 
  csInterface.dispatchEvent(keepAlive);  
}());  
Community Expert
August 2, 2019

Hi John,

Go through the following links which discuss on how to achieve this. Its a bit tricky but you can try these options on revert back if something specific does not work

Re: com.adobe.csxs.events list

On panel close event?

-Manan

-Manan
AD4003Author
Inspiring
August 2, 2019

Thanks you Manan for your valuable reply.

I have tried some events but it fails. I am in need for indesign.

"com.adobe.csxs.events.WindowVisibilityChanged" -  the event is not invoked.

var csInterface = new CSInterface();

csInterface.addEventListener("com.adobe.csxs.events.panelWindowStatusChanged", closePanel);

function closePanel() {

   alert("close");

   //write logic here

}

The closePanel function is not invoked.

Thanks.

Ten A
Community Expert
Community Expert
August 5, 2019

Are you set persistent in your extension?

I tried below and works fine in my environment.

(function() { 

  'use strict'; 

  var csInterface = new CSInterface(); 

  var keepAlive = new CSEvent("com.adobe.InDesignPersistent", "APPLICATION"); 

  keepAlive.extensionId = "<com.example.myextensionID>"; 

  csInterface.dispatchEvent(keepAlive); 

  new csInterface.addEventListener("com.adobe.csxs.events.panelWindowVisibilityChanged",

  function(event) { 

  alert('Window Visibility: ' + event.data); 

  }

  ); 

}());