Skip to main content
New Participant
June 27, 2019
Answered

Mysterious EvalScript errors from ModalDialog

  • June 27, 2019
  • 1 reply
  • 1731 views

Hi,

I'm working on an inDesign extension (with type `ModalDialog`) and run into this mysterious problem. When the extension is used for the first time after inDesign is launched, my ExtendScript functions fails (it doesn't happen every single time, but pretty often). And when it fails, it stays in the broken mode until the extension is re-opened. The failed ExtendScript function can be anything that tries to make a change (for example: `app.jpegExportPreferences.pageString = '1'`).

If I change `ModalDialog` to `Panel` in the manifest.xml, the problem goes away. But from the product perspective, I can not use `Panel` because I have to make sure user can not make changes to the inDesign file while this extension is opened.

I have uploaded a zip file to debug it. Here is how to reproduce:

1. Unzip the file and put it into your local extension folder (Mac: `~/Library/Application\ Support/Adobe/CEP/extensions/`, Win: `C:\Users\<USERNAME>\AppData\Roaming\Adobe\CEP/extensions`)

2. Launch inDesign;

3. Open any inDesign file;

4. Open the extension via `Window -> Extensions -> Modal dialog demo`;

5. Click the two buttons in the extension (The first button reads `app.jpegExportPreferences.pageString`, which always success. The second one tries to update this value, which fails on the first launch);

6. If the second button returns `EvalScript error`, close and reopen the extension (without closing inDesign) makes the problem goes away;

modal-dialog-demo.zip - Google Drive

This topic has been closed for replies.
Correct answer Manan Joshi

The reason is that with a modal extension you can't make changes to the document. If you enclose your code in a try catch block and alert the exception it will give the same message, something on the lines "Can't execute this action while a modal dialog is active"

-Manan

1 reply

Manan JoshiCorrect answer
Brainiac
June 27, 2019

The reason is that with a modal extension you can't make changes to the document. If you enclose your code in a try catch block and alert the exception it will give the same message, something on the lines "Can't execute this action while a modal dialog is active"

-Manan

Brainiac
June 27, 2019

I will however move this discussion to the Extension forum, so that someone can give you some ideas on how to achieve this.

-Manan