Team LiB
Previous Section Next Section

B.2. Dialog Boxes

In HyperTalk, there are two commands for displaying dialog boxes: answer and ask. You use answer when you want to just present information onscreen, like this:

answer "Fortune cookie says: You will enjoy good health."

On the other hand, when you want to use HyperCard dialog boxes to get information, you use ask, like this:

ask "How old are you?"
put it into theAge --The variable "theAge" now holds your dialog box response

In AppleScript, however, you use the display dialog command to accomplish both tasks, like this:

display dialog "Fortune cookie says: You will enjoy good health."
set theAge to the text returned of (display dialog "How old are you?" ¬
        default answer "")

    Team LiB
    Previous Section Next Section