For me, the biggest problem preventing migration to UXP is reading and writing text files.
One of the issues is shown in the InDesign sample script.
Even with InDesign 19.4, there are only 19 sample scripts for UXP compared to 21 sample scripts for ExtendScript. That is, two are missing.
Among them, I created “PlaceMultipagePDF.idjs” by myself while studying. (PlaceMultipagePDF.idjsを作ったぞ(ExtendScriptからUXP Scripting) | CS5)
However, “FindChangeByList.idjs” cannot be created. Because line 124 of “FindChangeByList.jsx”
myLine = myFindChangeFile.readln();
This is because there is no equivalent function, that is, the ability to read a text file line by line. Of course the InDesign team should know.
Currently, to achieve this with UXP, it is necessary to read the entire text file and divide it into arrays using line feed codes, which requires extensive rewriting.
There’s another big problem with text files. Encoding cannot be specified in UXP. All are treated as UTF-8.
However, there are some functions in InDesign that cannot handle UTF-8. First is “InDesign tagged text”. In the case of the Japanese edition, the encodings that can be handled are “ASCII”, “ANSI”, “Unicode(UTF16LE)”, “Shift_JIS”, “GB18030”, “Big 5”, and “KSC5601”.
There’s no UTF-8 here, so I can’t create the text file I want to use with “InDesign Tagged Text”.
Next is “Data Marge”. Although this function is often used alone, it has many inconveniences, such as line breaks cannot be included in the field
and there is no function to automatically adjust the horizontal ratio, character spacing, and font size.
, and execute it using a script, including the processing after data import. However, in the case of Japanese, the encoding of the source file will be “Unicode (UTF16LE)” and “Shift_JIS”. This is because this function cannot handle UTF-8.
I’ve been requesting this from the InDesign team for quite some time, but there’s no sign of it ever happening.
There is also a problem with newline codes. In InDesign, Chr(10) is a Forced line break and Chr(13) is a Line break, so you need to use them properly, but in ExtendScript, there is a problem that both are replaced with the character of odeline break setting. UXP doesn’t allow reading line by line, so I’m not sure what the problem is.
One of the issues preventing migration is the issue with ExtendScript’s own objects.
Typical examples are $object and UnitValue object. $objects are commonly used in any application. The UnitValue object is required in countries that use units of measurement other than points. It probably doesn’t matter much for Photoshop, but it’s essential for InDesign and Illustrator.
Script UI has become essential for scripters. In InDesign Dialog, if you create a dialog with checkboxes for each paragraph style, the dialog may extend beyond the screen depending on the number of paragraph styles. We were able to replace those parts with Script UI. However, this cannot be done easily with UXP Scripting, so you must consider UXP Plugin. I would like to be able to easily handle dialogs in HTML with UXP Scripting.
Finally, there is the issue of tools.
For scripters, the most important thing is the one-liner. While writing a script, it’s common to run a small script with a few lines just to see what’s going on.
ESTK was very useful for doing that. Because you can run it without saving the file. You can also use the console in VSCode to run unsaved code, but you can only write one line, which is a bit inconvenient.
Currently UXP Scripting doesn’t seem to have a tool to do that. It is very time-consuming to save a single-use script with a name in order to run it, as you will have to delete it later.