Skip to main content
vnh68
Inspiring
March 21, 2023
Answered

(UXP script) ScriptMenuActions method addEventListener rejects handler as not function

  • March 21, 2023
  • 1 reply
  • 465 views

I am trying to convert a working ESTK script to InDesign UXP one. It should use the menu.
A new menu item can be added without errors.
The error occurs when registering the "beforeDisplay" and "onInvoke" event handlers with the addEventListener method.
Error:
Invalid value for the "handler" parameter of the add method. Expected File or JavaScript Function but got () .

Then I took the BeforeDisplay.jsx file from the latest version of the SDK for testing and renamed it to BeforeDisplay.idjs. The line #targetengine had to be commented.

The error is the same. The event handler could not be registered.

 

This topic has been closed for replies.
Correct answer Peter Kahrel

UXP scripting is still in development -- the lack of support for event handlers is one of the (still) missing features, apparently, For production scripts you'd better stick with ExtendScript.

1 reply

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
March 21, 2023

UXP scripting is still in development -- the lack of support for event handlers is one of the (still) missing features, apparently, For production scripts you'd better stick with ExtendScript.

vnh68
vnh68Author
Inspiring
March 21, 2023
Thank you for your answer! Indeed, everything is just getting started and
it will be a long time to use ExtendScript...

I already thought that I missed the moment and started looking for
instructions on this topic.