Skip to main content
dublove
Legend
July 3, 2025
Answered

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

  • July 3, 2025
  • 2 replies
  • 324 views

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.

 

Correct answer Laubender

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 )

2 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
July 3, 2025

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 )

dublove
dubloveAuthor
Legend
July 3, 2025

It's a good idea. Bookmark it.

m1b
Community Expert
Community Expert
July 3, 2025

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

dublove
dubloveAuthor
Legend
July 3, 2025

Complicated even.
It's not particularly necessary.