Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Request

Built-in

SYNTAX

Request [message] [-d defaultText] [-q]

DESCRIPTION

The Request command displays a dialog box requesting information. The dialog box contains a request (message), a text field, and OK and Cancel buttons. If the user clicks the OK button, Request writes the text contained in the text field to standard output. If the user clicks the Cancel button, no output is generated.

INPUT

Standard input, unless you specify the message parameter.

OUTPUT

Unless the user clicks the Cancel button, Request writes the contents of the text field to standard output.

STATUS

Request can return the following status codes:

0

OK button selected (or Cancel button if -q option specified; see below)

1

syntax error

4

Cancel button selected (unless the -q option is specified; see below)

PARAMETERS

message

Specifies a message requesting information. Remember to place quotation marks around message if it contains any spaces or special characters.

OPTIONS

-d defaultText

Sets the default text that appears in the text field of the dialog box.

-q

Forces Request to return a status of 0 regardless of which button the user selects. This option is useful in scripts because the command normally terminates script execution (and returns status code 4) if the user selects the Cancel button.

EXAMPLES

This example displays the dialog box shown below, which allows the user to enter the name of a file to be compiled. The default is set to the name of the active window. Note that the default automatically appears in the text field and is used as input for the Set command, which defines the {FileName} variable, unless it is modified.

Set Exit 0
Set FileName "`Request 'File to compile' -d "{Active}"`"
If {FileName} ≠ ""
MrC "{FileName}" ≥≥ "{WorkSheet}"
End
Set Exit 1


SEE ALSO

Alert

Confirm

 
 


Last Updated July 2000