Skip to main content
Inspiring
January 23, 2025
Question

Alert dialog box custom width

  • January 23, 2025
  • 1 reply
  • 150 views

Is there a way of specifying the width of the alert box?? ie preferredSize.width = 300;

 

I often use them to display file names with full paths - and those tend to get line-wrapped - which I find difficult to read; prefering them one line apiece.

 

Without having to say... create a custom window?

 

Fake file real place, BTW.

 

 

function scriptAlert(alertString1) 
{
    var alertWindow = new Window("dialog", undefined, undefined, {resizeable: false});
    alertWindow.preferredSize.width = 300;
    var alertText = alertWindow.add("group");
    alertStringSize1 = alertText.add("statictext", undefined, alertString1, {name: "alertText", multiline: true});
    var okButton = alertWindow.add("button", undefined, undefined, {name: "okButton"});
    okButton.text = "OK";
    alertWindow.show();
}

 

 

1 reply

Stephen Marsh
Community Expert
Community Expert
January 25, 2025

@Ghoul Fool 

 

Not that I am aware of, these are native OS windows.

 

I have always been challenged with scriptUI. So when I found out about the dialog builder from Joonas Pääkkö, I created some template/boilerplate versions of the standard UI windows and added the additional code required to "do stuff":

 

https://github.com/MarshySwamp/ScriptUI-Alert-Window

 

https://github.com/MarshySwamp/ScriptUI-Prompt-Window

 

https://github.com/MarshySwamp/ScriptUI-Prompt-Window-Integer

 

https://github.com/MarshySwamp/ScriptUI-Confirm-Window