Go to: Synopsis. Return value. Flags. MEL examples.
 promptDialog [-backgroundColor float float float] [-button string] [-cancelButton string] [-defaultButton string] [-dismissString string] [-message string] [-messageAlign string] [-parent string] [-scrollableField boolean] [-style string] [-text string] [-title string]   
promptDialog is undoable, queryable, and NOT editable.
The promptDialog command creates a modal dialog with a message to the user, a text field in which the user may enter a response, and a variable number of buttons to dismiss the dialog. The dialog is dismissed when the user presses any button or chooses the close item from the window menu. In the case where a button is pressed then the name of the button selected is returned. If the dialog is dismissed via the close item then the string returned is specified by the -ds/dismissString flag. The default behaviour when no arguments are specified is to create an empty single button dialog. To obtain the text entered by the user simply query the -tx/text flag.| string | Indicates how the dialog was dismissed. If a button is pressed then the label of the button is returned. If the dialog is closed then the value for the flag ds/dismissString is returned. | 
In query mode, return type is based on queried flag.
| Long name (short name) | Argument types | Properties | ||
|---|---|---|---|---|
| -backgroundColor(-bgc) | float float float |   | ||
| 
 | ||||
| -button(-b) | string |    | ||
| 
 | ||||
| -cancelButton(-cb) | string |   | ||
| 
 | ||||
| -defaultButton(-db) | string |   | ||
| 
 | ||||
| -dismissString(-ds) | string |   | ||
| 
 | ||||
| -message(-m) | string |   | ||
| 
 | ||||
| -messageAlign(-ma) | string |   | ||
| 
 | ||||
| -parent(-p) | string |   | ||
| 
 | ||||
| -scrollableField(-sf) | boolean |   | ||
| 
 | ||||
| -style(-st) | string |   | ||
| 
 | ||||
| -text(-tx) | string |    | ||
| 
 | ||||
| -title(-t) | string |   | ||
| 
 | ||||
|  Flag can appear in Create mode of command |  Flag can appear in Edit mode of command | 
|  Flag can appear in Query mode of command |  Flag can be used more than once in a command. | 
// Create an OK/Cancel prompt dialog.
//
// +-+---------------------+
// |-|    Rename Object    |
// +-----------------------+
// | Enter Name:           |
// | +-------------------+ |
// | |                   | |
// | |                   | |
// | +-------------------+ |
// +-----------------------+
// | +-------+  +--------+ |
// | |  OK   |  | Cancel | |
// | +-------+  +--------+ |
// +-----------------------+
//
string $text;
string $result = `promptDialog
    -title "Rename Object"
    -message "Enter Name:"
    -button "OK" -button "Cancel"
    -defaultButton "OK" -cancelButton "Cancel"
    -dismissString "Cancel"`;
if ($result == "OK") {
    $text = `promptDialog -query -text`;
}