Skip to main content
Inspiring
September 29, 2025
Answered

Does extendscript have an event listener?

  • September 29, 2025
  • 1 reply
  • 257 views

Does illustrator extendscript have an event listener?
I need a certain function to be activated when a object/group is selected.

I am planning to actually use this in cep extension, it will be some change in UI depending on number of selected objects. 

Correct answer Charu Rajput

Yes, you need to include the file in your code where all these events are defined.

Attach is the link to download the file.

https://drive.google.com/file/d/1OiE-CwfqWjfanLXc24XLSLgYIvJgPA01/view?usp=drive_link

 

Let me know if that works after including the file.

1 reply

Charu Rajput
Community Expert
Community Expert
September 29, 2025

Hi,

Yes, you can use the AIHostAdapter to capture the selection event. The event you’re looking for is:

AIEvent.ART_SELECTION_CHANGED

For more information about AIHostAdapter, you can refer to the following link:
https://community.adobe.com/t5/illustrator-discussions/aihostadapter-plugin-windows-install/m-p/12727345

 

Best regards
Inspiring
September 30, 2025

Hi @Charu Rajput 
Thank you for this!

I pasted AIHostAdapter.aip inside:
.....\Plug-ins\Extensions
and AIHostAdapter is now in AI System info

and in js I tried this code:
AIEventAdapter.getInstance().addEventListener(
AIEvent.ART_SELECTION_CHANGED,
function (eve) {
alert(eve.type + " invoked.");
}
);

But it does not work.
Do I need something else here, on github there are  only AIHostAdapter.aip?
 https://github.com/Adobe-CEP/CEP-Resources/tree/master/CEP_11.x/AIHostAdapter

Charu Rajput
Community Expert
Charu RajputCommunity ExpertCorrect answer
Community Expert
October 2, 2025

Yes, you need to include the file in your code where all these events are defined.

Attach is the link to download the file.

https://drive.google.com/file/d/1OiE-CwfqWjfanLXc24XLSLgYIvJgPA01/view?usp=drive_link

 

Let me know if that works after including the file.

Best regards