BASIC DIALOGS in MEL
confirmDialog -- promptDialog -- fileDialog

 
confirmDialog



string $result = `confirmDialog -title "Confirm" -message "Are you sure?"
     -button "Yes" -button "No" -defaultButton "Yes"
     -cancelButton "No" -dismissString "No"`;

if ($result == "Yes") {
     print "continuing into dangerous territory\n";
} else warning "this operation has been terminated\n";


promptDialog
a good choice if you only need one value input from the user.



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`;
     print ($text + "\n");
}

  
fileDialog
opens a file browser and will return the selected file and path as a string
-directoryMask is optional



string $result = `fileDialog -directoryMask "*.mb"`


These are the basic dialogs in MEL, a few others such as fontDialog can be found
in the online command reference.