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

InDesign 18.4 completely broke UXP-Scripts by removing globally available classes like "NothinEnum"

New Here ,
Jul 11, 2023 Jul 11, 2023

Copy link to clipboard

Copied

Whereas v18.3 worked completely fine, something in InDesign 18.4 broke the API. 
Not even Adobes own "Getting started guide" works anymore. 
Take this for example: "Setting up measurement units and master spread margins"
The code-snippet to copy will fail with an error "app is not available". in v18.3 and before, "app" was available globally

var myDocument = app.documents.add();
//Set the measurement units and ruler origin.
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;


 To fix this first issue, you can import `app`manually like so:

const idd = require("indesign");
const app = idd.app;

var myDocument = app.documents.add();
//Set the measurement units and ruler origin.
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

This however will just fail with an error: "MeasurementUnits" is not defined.


The same problem occurs, if you try something like this, which has been working for years and is even referenced in Adobes own "Recipies", because "NothingEnum" is not available.

...
  app.findGrepPreferences = NothingEnum.nothing;
...


So is there something I've missed in the patch-notes? Or worse, is this behavior intentional?? If the latter, you should update the aforementioned guides...
 
Hope you can fix this soon, until then we'll have to stick with v18.3

TOPICS
Bug , Scripting , UXP Scripting

Views

318

Translate

Translate

Report

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

Adobe Employee , Jul 11, 2023 Jul 11, 2023

@B_I MEDIEN All the global objects have moved under the object returned by require("indesign")

In the code snippet shared by you, they are available under idd object.

 

 

const idd = require("indesign");
const app = idd.app;
var myDocument = app.documents.add();
myDocument.viewPreferences.horizontalMeasurementUnits = idd.MeasurementUnits.points;

 


And yes, this is incorrectly represented in the documentation. This will be fixed soon.

Votes

Translate

Translate
Adobe Employee ,
Jul 11, 2023 Jul 11, 2023

Copy link to clipboard

Copied

LATEST

@B_I MEDIEN All the global objects have moved under the object returned by require("indesign")

In the code snippet shared by you, they are available under idd object.

 

 

const idd = require("indesign");
const app = idd.app;
var myDocument = app.documents.add();
myDocument.viewPreferences.horizontalMeasurementUnits = idd.MeasurementUnits.points;

 


And yes, this is incorrectly represented in the documentation. This will be fixed soon.

Votes

Translate

Translate

Report

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