Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.
The ask
command displays a question (text1
) in a dialog box along with a text box where the user can type a reply. The ask
dialog automatically provides the OK and Cancel buttons.
You can supply a default reply using the with text2
option. The default text appears highlighted in the text box.
Ask
returns the text entered by the user, if any, in the local variable it
. If the user clicks Cancel, ask
places empty
in it
.
Ask
also sets the HyperTalk function the result
to empty
if the user clicks OK or to Cancel
if the user clicks Cancel. (So you can use the value of the result
to determine whether the user provides an empty string or clicks Cancel.) You must check the result
in the statement immediately after the ask
command.
Note: ask
automatically sizes the dialog box to fit the size of the text (up to thirteen lines). The total length of the text cannot exceed 254 characters for both the prompt and the default reply.
Ask password
displays a bullet (•) for each character the user types and encrypts the reply as a number. You can save this number in a field to compare with future passwords. (The ask password clear
form does not encrypt the reply, but it does display a bullet for each typed character.)
Note: ask password
is different from setting the password of the stack with the Protect Stack dialog. With ask password
, your handler must set and check any passwords.
Ask file
displays a directory dialog box in which you type the name of a file. The with filename
option provides a default name that appears in the text box.
An expression that evaluates to a text string that is also a valid Macintosh filename.
For example: