Log In | Not a Member? | Support | |
SYNTAX Confirm [message…] [-t] DESCRIPTION The Confirm command displays a confirmation dialog box with OK and Cancel buttons and the prompt message and returns the result in the {Status} variable. See the Status section for possible values of the {Status} variable. INPUT Standard input, unless you specify the message parameter. OUTPUT None
Confirm can return the following status codes:
Note
Note PARAMETERS message Specifies the message appearing in the confirmation dialog box. Be sure to place the message within quotation marks, which are stripped before the message appears in the dialog box. OPTIONS -t Displays a three-way confirmation dialog box with Yes, No, and Cancel buttons. In this case, a status of 4 means No and 5 means Cancel. EXAMPLES The command line Confirm "Is this the correct file?" displays the dialog box shown below.
Clicking OK generates a status code of 0, while clicking Cancel generates a status code of 4. Remember that the status code is stored in the {Status} variable and can easily be retrieved by using the command Echo {Status} When you use the Finder to copy one or more files to a folder or disk that already contains files of the same names, the Finder displays a dialog box asking if you want to replace the files. The same task can be accomplished with the following script:
Set Exit 0 which displays the dialog box shown below.
If you click the OK button, the MPW Shell executes the Duplicate command. The following script makes use of a three-way confirmation dialog box to print selected 'TEXT' files in the current directory: Set Exit 0 Set list "" For file In `files -t TEXT` Confirm -t "Print file {file}?" Set SaveStatus "{Status}" Continue If "{SaveStatus}" == 4 # No Break If "{SaveStatus}" == 5 # Cancel Set list "{list} '{file}' # Yes End If "{list}" != "" Print {PrintOptions} {list} End Set Exit 1 For each file, the script displays a dialog box with Yes, No, and Cancel buttons. If you click Yes, the file is placed in a list of files to be printed. If you click No, the Continue command causes this file to be skipped, but processing continues with the next file in the list. If you click Cancel, the Break command causes the For loop to be terminated, ending the question-and-answer session. The filenames are saved in the variable {list} and printed after the loop. SEE ALSO
|