Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Participant ,
Mar 21, 2023 Mar 21, 2023

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.

 

TOPICS
Scripting , UXP Scripting
326
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 21, 2023 Mar 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.

Translate
Community Expert ,
Mar 21, 2023 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2023 Mar 21, 2023
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines