Go to: Synopsis. Flags. Return value. MEL examples.
promptDialog [-backgroundColor float float float] [-button string] [-cancelButton string] [-defaultButton string] [-dismissString string] [-message string] [-messageAlign string] [-parent string] [-scrollableField boolean] [-text string] [-title string]
promptDialog is undoable, queryable, and 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.| Long name (short name) | [argument types] | Properties | ||
|---|---|---|---|---|
-title(-t)
|
string
|
|
||
|
||||
-message(-m)
|
string
|
|
||
|
||||
-messageAlign(-ma)
|
string
|
|
||
|
||||
-text(-tx)
|
string
|
|
||
|
||||
-scrollableField(-sf)
|
boolean
|
|
||
|
||||
-button(-b)
|
string
|
|
||
|
||||
-defaultButton(-db)
|
string
|
|
||
|
||||
-cancelButton(-cb)
|
string
|
|
||
|
||||
-dismissString(-ds)
|
string
|
|
||
|
||||
-parent(-p)
|
string
|
|
||
|
||||
-backgroundColor(-bgc)
|
float float float
|
|
||
|
||||
// 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`;
}