Skip to main content
Inspiring
May 31, 2023
Answered

IDJS (UXP) "glue code.jsx" Include Error

  • May 31, 2023
  • 1 reply
  • 718 views

I am trying to convert a fully functional .jsx script over to .idjs for use with InDesign server, and to take advantage of the ES6 support.

When I run the script from VS Code it works perfectly. However, if I try to run it from InDesign, or via outside script it throw the following error:

 

     UXPScript Error!

     Error String: SyntaxError: Private field '#include' must be declared in an enclosing class.

 

The error is referring to the #include: "glue code.jsx" at the top of the file. This line is included in every sample script Adobe provides for working with XML.

Unfortunately, if I try to convert this into a class it throws a new error telling me that I have made improper use of the reserved term "class".

 

Anybody know how to get this to work?

This topic has been closed for replies.
Correct answer Stefan278744972lgo

try using 

//@include
instead of #include

1 reply

Stefan278744972lgoCorrect answer
Participating Frequently
June 1, 2023

try using 

//@include
instead of #include
Inspiring
June 1, 2023

@Stefan278744972lgo That appears to have worked. Though I am confused as to why. I am new to JS, but how does setting this as a comment work?

Peter Kahrel
Community Expert
Community Expert
June 2, 2023

// marks a comment, //@ does not.

 

By the way, be aware that UXP is work in progress and that several ExtendScript elements don't work (or not yet) in UXP or work differently. And also be aware that UXP is still considerably slower than ExtendScript when dealing with InDesign documents. InDesign 18.4 allegedly brings many improvements, both in coverage and speed, but until then you should be aware of UXP's limitations.