Skip to main content
Participating Frequently
January 12, 2024
Answered

Indesign scripting: 1) window v. dialog

  • January 12, 2024
  • 3 replies
  • 865 views

Hi,

I am working on a script with a basic-ish UI, for Indesign 17, hoping to port it to v 18 (and beyond) eventually.

I was working with the documentation from the scripting sdk for v 17.4, which creates ui's using app.dialogs, eg:

var myDialog = app.dialogs.add({name:"Simple Dialog"});

But I also found this wonderful ui builder tool: https://scriptui.joonas.me/, but it uses "Window"s, eg:

var myWindow = new Window ("dialog", title);

From what I can tell so far, they are distinct in the object model (window, dialog) and have different properties etc. (For example I tried to use an "integerEditbox" in a Window as declared above and it is not recognized) 

Is one prefereable to the other, for ease of use &/or future-proofing/Adobe-support? 

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer rob day

For example I tried to use an "integerEditbox" in a Window as declared above and it is not recognized

 

Hi @Matt276783077obu , I think InDesign’s built-in dialog class is easier to use than the ScriptUI classes, but ScriptUI can build more complex dialogs. The integerEditbox object is part of the built-in dialog class, so you can’t use it with a ScriptUI window.

 

If you can work within the limits of the dialog class the code can be less complex—integerEditbox forces the user to enter an integer without any extra code. Or, the measurementEditbox lets you set any measurement unit and the return value will be converted to points for your main script.

3 replies

rob day
Community Expert
rob dayCommunity ExpertCorrect answer
Community Expert
January 12, 2024

For example I tried to use an "integerEditbox" in a Window as declared above and it is not recognized

 

Hi @Matt276783077obu , I think InDesign’s built-in dialog class is easier to use than the ScriptUI classes, but ScriptUI can build more complex dialogs. The integerEditbox object is part of the built-in dialog class, so you can’t use it with a ScriptUI window.

 

If you can work within the limits of the dialog class the code can be less complex—integerEditbox forces the user to enter an integer without any extra code. Or, the measurementEditbox lets you set any measurement unit and the return value will be converted to points for your main script.

Participating Frequently
January 16, 2024

Hi Rob, thanks for the thoughtful response. I ended up using a Window in this case b/c that drag and drop builder is so handy, and my UI layout ended up a little complex. Also I have to do some qualitative reponse validation beyond unit type anyways.

But  your response makes a lot of sense and your template is terrific and will come in handy in other cases I am sure. 🙂

Thanks again for taking the time!