Home
The HyperCard Center
HyperTalk Reference

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

reply

reply expression [with keyword ¬
aeKeyword]
reply error expression

Expression is any text. AeKeyword is an Apple event keyword (a 4-character string).

The reply command answers an incoming Apple event.

If you don’t specify a keyword, expression becomes the direct parameter of the reply.

You use reply error expression to notify the Apple event sender that an error has occurred.

You can use reply error expression to define your own error messages. This form is equivalent to reply expression with keyword "errs". The Apple event keyword “errn” sets the error number.

The reply command sets the result to No current Apple event when there is no current Apple event to handle.

Use reply only if you're handling Apple events yourself. If HyperCard handles an Apple event, it will provide the appropriate information in the reply.

See the documentation for the sending program to know which reply keywords it expects. (errs and errn are standard keywords.)

In AppleScript, you may need to reply with both an error string and an error number to trigger an error clause.

Examples

reply "Hello there, nice to hear from you"
reply error "Error in the remote stack"
reply 13023 with keyword "errn" -- Error #13023 occurred
The following script handles Apple events of class WILD and type defn. It searches for a string in a background field name ”Glossary Entry” and returns the contents of a background field named “Definition.”
on appleEvent eventClass, eventID, sender
if eventClass is "WILD" and eventID is "defn" then
request appleEvent data
find it in field "Glossary Entry"
if the result is empty -- find is successful
then reply field "Definition"
else reply error "Not found"
else pass appleEvent
end appleEvent

Related Topics

Placeholders

expression

HyperTalk Definition

Any HyperTalk expression. All expressions evaluate to text, a number, or a constant.

For example:

true
sin(90)
"this is" && it
(3+2) = 5
the heapspace div 1024

Note: Formally, HyperCard distinguishes between factors (simple values) and expressions. The difference between factors and expressions matters only if you like to drop parentheses. Most functions take factors as their parameters, which is why length of 3 + 5 returns 6 and length of (3 + 5) returns 1. In short, always use parentheses to group things the way you want them to evaluate, and you won’t have to worry about the difference between factors and expressions.

AppleScript Definition

Any series of words that has a value.

HyperTalk Reference

Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Retro View