Skip to main content
New Participant
December 4, 2022
Answered

UXP modeless dialog

  • December 4, 2022
  • 2 replies
  • 1520 views

Hello!

I am a software developer, but know relatively nothing about InDesign. I was tasked with creating a script to export all the text from a document.

So far I have created a UXP script that does this but it take a long time to run so I wanted to show a progress bar in a non-modal dialog. 

I've seen examples of scripts that use the new Window() constructor, but this doesn't seem to be supported in UXP... so my question is, how can I display a non-modal dialog so I can show some sort of progress as my script runs?

 

Thanks!

David

Correct answer Mike Bro

Hello @David272945657vhz,

 

Take a look at the link below to see if it points you in the right direction...

https://developer.adobe.com/indesign/uxp/uxp/reference-spectrum/User%20Interface/sp-progressbar/

 

Regards,

Mike

2 replies

erinferinferinf
Community Manager
Community Manager
December 5, 2022

Hi David,

 

When you say a non-modal dialog, do you mean like, a panel that persists on screen?

 

When it comes to UXP scripting in InDesign,  panels or plugins have not been enabled yet, but they are scheduled to roll out in 2023.

 

You could make a non-modal dialog by building a CEP panel... but it's not as easy, due to the use of much older JavaScript, (among other things).

New Participant
December 5, 2022

Hi Erin,

I'm not sure about a Panel, that sounds like an integrated component. I just meant a regular dialog but non-blocking, basically I need my script to keep running without waiting for the dialog to be dismissed.

 

What I ended up doing was creating a dialog as mentionned here: https://developer.adobe.com/indesign/uxp/reference/uxp-scripting-samples/ instead of using app.dialogs.add(), and I called show() instead of showModal().

 

So far this seems to work. I am only updating some text but I should be able to add the sp-progressbar as Mike mentioned.

I also needed to add some fake sleep using setTimeout() to allow the UI to update.

 

Mike BroCorrect answer
Brainiac
December 5, 2022

Hello @David272945657vhz,

 

Take a look at the link below to see if it points you in the right direction...

https://developer.adobe.com/indesign/uxp/uxp/reference-spectrum/User%20Interface/sp-progressbar/

 

Regards,

Mike