/
messagePrompt
messagePrompt
Description
Prompts the user with a window displaying a message and Yes/No/Ok/Cancel buttons.
Calling this command halts script execution until the user clicks on one of the buttons, or dismisses the window using the ESC key. Choices of button combinations are OK, OK/Cancel, Yes/No, and Yes/No/Cancel. The return value holds the code to the button that the user selected. If no button options are specified, an OK button only is displayed.
Here is a list of buttons and their codes/return values:
Button | Return Code |
---|---|
OK/Yes | 1 |
No | 0 |
Cancel | -1 |
Functional area
Interface
Command syntax
Syntax
messagePrompt "message"[-okCancel integer] [-yesNo integer] [-yesNoCancel integer] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
message | string | yes | Message to display to the user. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
okCancel | 1 | integer | yesNo, yesNoCancel | Displays an OK and a Cancel button. Integer value specifies the "default" button. |
yesNo | 1 | integer | okCancel, yesNoCancel | Displays a Yes and a No button. Integer value specifies the "default" button. |
yesNoCancel | 1 | integer | okCancel, yesNo | Displays a Yes, a No, and a Cancel button. Integer value specifies the "default" button. |
Return value
integer
Examples
// Prompt the user with a message and proceed according // to the button that was clicked. Make No the default button int $returnCode; boolean $shouldSave; $returnCode = `messagePrompt "Not all nodes are selected for export.\n\n Do you still want to save?" -yesNoCancel 0`; switch( $returnCode ) { case -1: // User clicked Cancel. Exit the script return; case 0: // User clicked No. Don't save $shouldSave = false; break; case 1: // User clicked Yes. Can proceed with save $shouldSave = true; break; } // Save if it's safe to save, according to the user. $if( $shouldSave ) { saveFile -s;
}
Additional information
Related commands
, multiple selections available,
Related content
setPushButtonHandler
setPushButtonHandler
More like this
createCheckBox
createCheckBox
More like this
setCheckBoxHandler
setCheckBoxHandler
More like this
setRadioButtonHandler
setRadioButtonHandler
More like this
Use the Shogun Post Script Editor
Use the Shogun Post Script Editor
More like this
createShelfButton
createShelfButton
More like this