User interaction
 
 
 

These commands let you pause your script to get input from the user. To create complex custom user interfaces, see Creating interfaces.

Asking a question with confirmDialog

The confirmDialog command creates a modal window with a message to the user and any number of buttons.

The window disappears when the user presses any button or clicks the window’s close button.

confirmDialog -title "Confirm" -message "Are you sure?"
	-button "OK" -button "Cancel" -defaultButton "OK"
	-cancelButton "Cancel" -dismissString "Cancel";

Letting the user choose a file with fileDialog

The fileDialog command shows a file open dialog window.

fileDialog -directoryMask "*.txt"

Getting a string with promptDialog

The promptDialog command creates a window with a message to the user, a text box, and any number of buttons.

// Show the dialog box:
string $text;
string $result = `promptDialog
	-title "Rename Object"
	-message "Enter Name:"
	-button "OK" -button "Cancel"
	-defaultButton "OK" -cancelButton "Cancel"
	-dismissString "Cancel"`;
// Use the command again in query mode to
// get the text:
if ($result == "OK") {
	$text = `promptDialog -query -text`;
}