Skip to main content
dublove
Legend
Jul 3, 2025 4:49 AM UTC
Answered

Is there any way to automatically center the content in the alert(“”) dialog?

For example, there are multiple lines.

Like this, Can I only hit a space to center it?
alert("         Note that \n         ●●●\n you have chosen nothing").

Thank you very much.

 

LaubenderCorrect answer
Community Expert
Jul 3, 2025 4:30 PM UTC

Hi @dublove ,

as Mark already mentioned, you could write your own alert dialog with e.g. ScriptUI; make it even scrollable when a lot of text should be readable. Search for scrollable alert for InDesign on the web*.

However, you'll not be able to center paragraphs, it's just left aligned text in one particular text size and no formatting like Bold, Italic or Bold-Italic or a different text color ( once, about 13 years back, formatting of text in ScriptUI was possible; with the upcomming of InDesign CC (after CS6) ScriptUI broke in a lot of ways and was never fixed. ) .

 

* Found sample code within a few seconds:

 

Scrollable alert
Marijan Tompa (tomaxxi)
July 28, 2010
https://indisnip.wordpress.com/2010/07/28/scrollable-alert/

 

To give you two sample screenshots:

 

 

Some text selected in the dialog that could be copied/pasted through the clipboard:

 

 

For ScriptUI see also Peter Kahrel's documentation:

ScriptUI for dummies
Peter Kahrel

https://creativepro.com/files/kahrel/indesign/scriptui.html

 

Regards,
Uwe Laubender
( Adobe Community Expert )

4 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
Jul 3, 2025 4:30 PM UTC

Hi @dublove ,

as Mark already mentioned, you could write your own alert dialog with e.g. ScriptUI; make it even scrollable when a lot of text should be readable. Search for scrollable alert for InDesign on the web*.

However, you'll not be able to center paragraphs, it's just left aligned text in one particular text size and no formatting like Bold, Italic or Bold-Italic or a different text color ( once, about 13 years back, formatting of text in ScriptUI was possible; with the upcomming of InDesign CC (after CS6) ScriptUI broke in a lot of ways and was never fixed. ) .

 

* Found sample code within a few seconds:

 

Scrollable alert
Marijan Tompa (tomaxxi)
July 28, 2010
https://indisnip.wordpress.com/2010/07/28/scrollable-alert/

 

To give you two sample screenshots:

 

 

Some text selected in the dialog that could be copied/pasted through the clipboard:

 

 

For ScriptUI see also Peter Kahrel's documentation:

ScriptUI for dummies
Peter Kahrel

https://creativepro.com/files/kahrel/indesign/scriptui.html

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
dublove
dubloveAuthor
Legend
Jul 3, 2025 5:52 PM UTC

It's a good idea. Bookmark it.

Translate
m1b
Community Expert
Community Expert
Jul 3, 2025 6:30 AM UTC

I don't think you have control of the text in the alert—you definitely don't on MacOS, but I'm not sure about Windows. I doubt it.

 

Another option is ot create a ScriptUI dialog window that replicates the alert you want. It shouldn't be too hard. Maybe ask ChatGPT exactly what you want?

- Mark

Translate
dublove
dubloveAuthor
Legend
Jul 3, 2025 6:44 AM UTC

Complicated even.
It's not particularly necessary.

Translate