O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Standard Additions

Dictionary classes

dialog reply

This record object is the return value of the display dialog scripting addition. display dialog displays a message in a modal dialog window (i.e., a window that appears in front of other windows), optionally requests the user to enter some text in an edit field, and optionally closes itself after a specified number of seconds. A record is a series of name/value pairs separated by commas and surrounded by a pair of curly braces. The return value for the following example looks like this:

{text returned:"Bruce", button returned:"OK", gave up:false}

Your return value will only include the gave up property if the display dialog command included the giving up after parameter when the command was used, as in display dialog "Tired of me yet?" giving up after 10.

set rep to (display dialog "Identify yourself please." default¬
answer "" giving up after 30)
(*
the variable rep could contain this:
{text returned:"Bruce", button returned:"OK", gave up:false}
*)

The following are dialog reply properties:

button returned string (read-only)

This property returns the label of the button the user clicked on the dialog. You can get this value with code such as:

set theButton to (button returned of the result)

text returned string (read-only)

This property returns the text (if any) the user entered in the edit field of the dialog. You can get this value with code such as:

set theText to (text returned of the result)

gave up boolean (read-only) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required