Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Keywords

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

send

send "messageName [parameterList]"¬
   [to object]

send "messageName [parameterList]"¬
   to HyperCard

send expression  to { program ¬
   program | program id programID | ¬
    this program } [without reply]

In the first two forms, the send keyword sends a message directly to a particular object or to HyperCard. For example, you can send a message to an object already passed by in the message- passing order (from a stack back to the current card), or you can bypass handlers later in the message-passing order that might otherwise handle the message.

You can send messages to any object in the current stack, and you can send messages to another stack (but not to objects within another stack).

Important: If you send a message to a card other than the current card, HyperCard doesn’t go to the card or open it.

For example, if you send a message to another stack, and the handler refers to a field that’s specific to that stack, you’ll get a script error.

HyperCard evaluates any parameters before it sends the message, even though the entire message is in quota- tion marks. (You don’t need quotation marks if the message is a single word.)

When an object receives a message from send, HyperCard sets the value of the target to the name of the object.

If the object doesn’t handle the message, the message continues along the message-passing path from that point.

If you send a message directly to HyperCard, you ensure that no other objects will handle the message. For example, send "doMenu next" to HyperCard always takes you to the next card.

You can type send as a message in the Message box.

The third form sends a do script Apple event from HyperCard to another running application:

send expression  to { program ¬
   program | program id programID | ¬
   this program }  [without reply]

where program is the path name to the target program in the form zone:computer:program, and programID is the signature of a program on the same computer. this program denotes HyperCard.

expression is any valid expression or any sequence of commands in the scripting language supported by the target program. If the target program is HyperCard, the scripting language is HyperTalk.

By default, HyperCard waits for a reply from the target program before continuing; but you can specify without reply if you don't want to wait for one.

Any reply from the target program goes into the result.


Examples

send "hideIt" to field 3  
send "addSums 3,45.67,344.00" to stack "Expense Account"  
send "mouseUp" to button "Click Me"  
send "doMenu" && quote & "print card" & quote to HyperCard

Demo Script

on sendDemo
   send "mouseDown" to bkgnd btn "close" -- to animate the close box
   wait 20
   send "mouseUp" to bkgnd btn "close" -- to put away this demo
 end sendDemo

Placeholders

messageName
Any text string, without quotation marks, that represents the name of the message handler you want to write:

calculateDebt
selectWholeLine
As in:
on calculateDebt
on selectWholeLine theLine, aContainer


parameterList
A comma-separated list of local variable names.

The actual names don’t matter as long as they’re not the same as one of HyperCard’s reserved words. (That is, don’t use result as a variable name.) For example:

var1
var1,var2,var3, var4
fieldName, N, numberOfCharacters


object
HyperTalk DefinitionThe object HyperCard, or any expression that identifies an object by name, number, or id.

For example:

HyperCard
me
[the] target
button 1
background part 6
card field id 3894
this card
next background
stack "My Stack"
AppleScript DefinitionAn identifiable part of an application, or a thing within an application that can respond to commands.

expression
HyperTalk DefinitionAny 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 DefinitionAny series of words that has a value.

Related Topics

« return | HyperTalk Reference

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View