HyperTalk - Exam Prep Study Guide
[English]
HyperTalk Basics
Set the user level to scripting
- There are 5 user levels in Apple HyperCard.
- Browsing
- Typing
- Painting
- Authoring
- Scripting
- Before you can write your own scripts, you must set your user level to Scripting (5). Type the following in the message box. (Note that the portions enclosed in square brackets "[]" are optional.)
- set [the] userLevel [of HyperCard] to 5
HyperTalk and scripts
- HyperTalk (TM) is Apple HyperCard's script language. You use it to write English-like statements that respond to events (such as when the user clicks a button or goes to a new card).
- In HyperTalk, responding to an event is called handling the event. As a scripter, you write a specific handler for each event that you want your stack to handle. A collection of handlers is called a script.
- The following shows a handler for event "mouseUp". It can be part of the script of card button id 1.
- on mouseUp
- beep
- end mouseUp
What are messages?
- A message is simply an announcement that an event has occurred: The user has clicked the mouse, requested the answer to (4 * 3), added a new card to a stack, and so on.
- To understand messages, think of mailing a letter to a friend. You write a message and place it inside an envelope. Then you address the envelope and send it to your friend. HyperCard does the same thing:
- It determines the content of a message (what just happened).
- It decides where to send the message.
- What's the content of a message?
- The message itself is just HyperCard's name for the event that occurred. HyperCard acts as a translator: it "watches" the stack and translates events into message names.
- Where does HyperCard send the message?
- HyperCard determines what object the user has acted on, and uses this as the "address" for the message. HyperCard then sends the message to one of its objects:
- a button (btn)
- a field (fld)
- a card (cd)
- a background (bg)
- a stack
- Once HyperCard knows both the content of the message (the message name) and the destination of the message (where to send it), it sends the message to the object.
Handling messages
- As a scripter, you write message handlers to respond to messages. When an object receives a message, HyperCard searches the object's script for a handler with the same name (a handler starts with the word "on" followed by the name of a message). If HyperCard finds a match, it runs any HyperTalk statements in the handler until it hits an "end" statement.
- For example, if you want a button to respond to a "mouseUp" message, you would add a message handler "mouseUp" to its script.
- on mouseUp
- beep
- end mouseUp
The message-passing order
- What happens if an object that receives a message doesn't handle it?
- In this case, HyperCard passes the message to other objects and searches their scripts for a message handler that matches the current message. The order in which HyperCard passes a message to objects is called the message-passing order or the message-passing path.
- Initially, HyperCard sends messages to a specific button or field or to the current card. If a button or field doesn't handle the message, it goes on to the current card. From the current card, the message goes to the following objects, in order:
- the current background
- the current stack
- the stack script of stack "Home"
- HyperCard itself
Writing message handlers
- When you write a handler for a message, you specify a sequence of statements for HyperCard to run. Each message handler has the following form:
- on messageName
- -- statements
- end messageName
- When it runs the message handler, HyperCard sends each line of the handler as a message itself (so handlers can call other handlers).
- Important: The message name does not have to be one of HyperCard's built-in system messages or commands.
- For example, if you wanted a new command called "doubleBeep" that would beep twice, you would write a handler for it as follows:
- on doubleBeep
- beep
- beep
- end doubleBeep
- Of course, HyperCard doesn't know about command "doubleBeep", so it will never be sent automatically in response to an event. But you can send "doubleBeep" from the message box or use it as a statement in other handlers:
- For example, the script of a card button might contain the following handler for system message "mouseUp":
- on mouseUp
- doubleBeep
- end mouseUp
- If the script also contains handler "doubleBeep" (or if the script of any object later in the message-passing path contains it), message "mouseUp" will send message "doubleBeep", and "doubleBeep" will send 2 "beep" commands. Because "beep" is a built-in command, HyperCard beeps twice.
- If HyperCard can't find message "doubleBeep", it will complain (with a dialog box) that it "can't understand" the message.
Using parameter variables
- A handler can receive values (called parameters) and use them as it runs. You represent each value with a parameter variable. A parameter variable always follows the handler name in a comma-separated list.
- For example, when running the following handler "mouseUp", HyperCard calls "sayMessage" with 2 values, "red" and "apple". It then binds these values to parameter variables theColor and theFruit in handler "sayMessage".
- on mouseUp
- sayMessage "red", "apple"
- end mouseUp
- on sayMessage theColor, theFruit
- put "I want a " & theColor & " " & theFruit & "."
- end sayMessage
- You can use variables theColor and theFruit anywhere inside the handler. When HyperCard sees them, it uses the values currently bound to them. (The variables remain bound only while the handler runs.)
Writing function handlers
- When you write a handler for a function, you specify statements that compute and return a value to the handler that calls the function. Each function handler has the following form:
- function functionName
- -- statements
- end functionName
- HyperCard has many built-in functions, but you can also write your own:
- on mouseUp
- put squareIt(5) into the message box
- end mouseUp
- function squareIt x
- return (x * x)
- end squareIt
- The function "squareIt" receives a number through its parameter variable, x. It then returns the value of (x * x) to the handler that called it ("mouseUp") using keyword "return".
The building blocks
- HyperTalk scripts use a number of basic building blocks as sources of value:
- basic sources of value
- The basic sources of value in HyperTalk are as follows:
- a number (3, -99.9, and so on)
- a literal, a string of characters set off (delimited) by quotation marks
- a boolean value (true or false)
- operator
- An operator is a character or group of characters that causes a particular calculation or comparison to occur. In HyperTalk, operators operate on values.
- expression
- An expression is simply a description of how to get a value; it is either a basic source of value or a complex expression built from sources of value and operators.
- constant
- A constant is a named value that never changes.
- local variable
- A local variable is a named container (a place to store values) whose value is whatever you put into it. A local variable is valid only within the handler in which it is used - the variable goes out of existence when the handler ends. You create a local variable by using its name with command "put" and putting a value into it.
- global variable
- A global variable is a named container (a place where you can store values) whose value is whatever you choose to put into it, but it is valid for all handlers in which it is declared. To declare a global variable, precede its name with keyword "global".
- You also create a global variable when you put a value into a variable from the message box.
- it
- "it" is a pre-defined variable. HyperCard uses "it" to store information that's returned by commands such as "ask", "answer", "convert", and "read". You can also place a value directly into "it" using command "get" ("put 3 into it" and "get 3" are equivalent). When set in a handler, the value of "it" is local to the handler. When set from the message box, the value of "it" is global.
- Use "it" when you need a variable temporarily. Use a named, local variable when you want to refer to a value throughout a handler - it's too easy to change the value of "it" accidentally.
- button (btn)
- A button, like a variable, is also a container (a place where you can store values). The value of a button is equal to whatever text it contains.
- As with variables, the text that buttons hold is invisible; as with fields, the text in a button remains there - even between HyperCard sessions - until you change it.
- field (fld)
- A field, like a variable, is also a container (a place where you can store values). The value of a field is equal to whatever text it contains.
- Fields generally contain text you want users to see.
- message box
- The message box (also called the message window) is a single-line container.
- selection
- The selection is a container that holds the currently selected area of text. The text can appear in any field or in the message box. (Note: text found by command "find" is not selected.) The value of the selection equals the text that is highlighted.
- chunk expression
- A chunk expression is a description of a unique piece of the contents of any container or other source of value. A chunk expression can refer to a specific character, word (separated by blank spaces), item (separated by commas), line (separated by return characters), or a combination or range of these.
- property
- A property is a named value that defines a characteristic of a HyperCard object or the HyperCard environment. Properties are often selected as options in dialog boxes or on palettes, and they often can be set from handlers.
- function
- A function is a named value that HyperCard calculates each time it is used.
- The way in which the value is calculated is defined internally for HyperTalk's built-in functions. You can define your own functions by writing function handlers. Sometimes a script must supply a function with starting values or parameters. By definition, functions return a value.
- clipboard
- the clipboard
- put [text] into the clipboard
Referring to objects
- The following are HyperCard objects:
- A button (btn)
- A field (fld)
- A card (cd)
- A background (bg)
- A stack
- You can refer to HyperCard objects and other elements from a script in any of several ways:
- name
- An object's "name" is the value found in its Info dialog box.
- number
- An object's "number" represents its position among like objects within the object that contains it.
- Buttons and fields are ordered within a card or background. Cards and backgrounds are ordered within a stack.
- Changing the order of a button, field, card, or background changes its "number".
- ID
- An object or menu's "ID" is a unique number assigned by HyperCard. Object "ID" numbers never change. The Info dialog box for each object displays its "ID". (Stacks don't have "ID"'s.)
- A program's "ID" is its application signature.
- put the ID of HyperCard -- -> WILD
- part
- "part" refers to a specific button or field in its ordinal position among all the buttons and fields in that domain.
- If you don't specify a domain, the default domain is card.
- ordinal
- You can refer to an object using any of the following ordinals:
- first
- second
- third
- fourth
- fifth
- sixth
- seventh
- eighth
- ninth
- tenth
- middle
- last
- any
- position
- You can refer to some objects using any of the following positions:
- next
- prev
- previous
- this
- me
- "me" is one way to refer to an object dynamically. It refers to the object that contains the currently executing handler. With buttons and fields, "me" refers to the object itself or to its contents, depending on the context.
- target
- "the target" is another way to refer to an object dynamically. It refers to the object that first received the message currently being handled. With buttons and fields, use "the target" to refer to the field itself and "target" to refer to its contents.
Add comments to a script
- In HyperTalk scripts, 2 hyphens (--) indicate a comment. HyperTalk ignores all commented lines when executing a script.
Sample Handlers
- Arabic/Roman Numerals
- function numeralArabic theChar
- put "M,D,C,L,X,V,I" into theRoman
- put "1000,500,100,50,10,5,1" into theArabic
- put "0" into theReturn
- repeat with i = 1 to the number of items of theRoman
- if (theChar = item i of theRoman) then
- put item i of theArabic into theReturn
- exit repeat
- end if
- end repeat
- return theReturn
- end numeralArabic
- Digital Numbers
- function lowerToUpper theWord
- put "" into theReturn
- repeat with i = 1 to the number of chars of theWord
- put char i of theWord into theChar
- put charToNum(theChar) into theNum
- if ((theNum >= 97) and (theNum <= 122)) then
- put numToChar(theNum - 32) after theReturn
- else
- put theChar after theReturn
- end if
- end repeat
- return theReturn
- end lowerToUpper
- Character Rearranger
- on mouseUp
- set the cursor to "busy"
- put the selectedText of the target into theAction
- if (theAction <> "") then
- put "" into cd fld "Answer"
- put removeReturn(bg fld "Contents") into theBefore
- put "" into theAfter
- if (theAction = "Compress") then
- repeat with i = 1 to the number of chars of theBefore
- put char i of theBefore into theChar
- if (theChar <> return) then
- if (theChar <> " ") then
- put theChar after theAfter
- end if
- else
- put theChar after theAfter
- end if
- end repeat
- else if (theAction = "Expand") then
- repeat with i = 1 to the number of chars of theBefore
- put char i of theBefore into theChar
- put theChar after theAfter
- if (theChar <> return) then
- put " " after theAfter
- end if
- end repeat
- else if (theAction = "Reverse") then
- repeat with i = 1 to the number of chars of theBefore
- put char i of theBefore into theChar
- put theChar before theAfter
- end repeat
- else if (theAction = "Vertical") then
- repeat with i = 1 to the number of chars of theBefore
- put char i of theBefore into theChar
- put theChar & return after theAfter
- end repeat
- else if (theAction = "Words") then
- repeat with i = 1 to the number of words of theBefore
- put word i of theBefore into theWord
- put theWord & return after theAfter
- end repeat
- end if
- put theAfter into cd fld "Answer"
- end if
- beep 1
- end mouseUp
- Orchestra
- on mouseUp
- set the cursor to "busy"
- put the selectedText of the target into theAction
- if (theAction <> "") then
- put "" into theSounds
- repeat with i = 1 to (the number of cd btns - 1)
- put the selectedText of cd btn (i + 1) into theText
- if (theText <> "") then
- put theText & return after theSounds
- end if
- end repeat
- if (theSounds <> "") then
- repeat
- if ((the mouse = "down") or (theSounds = "")) then
- exit repeat
- else
- repeat with i = 1 to the number of lines of theSounds
- set the soundChannel to i
- play (line i of theSounds) (any item of "C,D,E,F,G,A,B") & (any item of "2,3,4,5") & (any item of "w,h,q,e,s")
- end repeat
- end if
- end repeat
- repeat with i = 1 to the number of lines of theSounds
- set the soundChannel to i
- play stop
- end repeat
- else
- answer "Select up to 8 sounds."
- end if
- end if
- beep 1
- end mouseUp
- Analog Clock
- on idle
- global globalCount,globalDate,globalTime
- if (globalCount = "true") then
- if (the shiftKey = "down") then
- lock screen
- reset paint
- choose oval tool
- set the filled to "true"
- set the pattern to "1"
- drag from "144,144" to "368,368" with optionKey
- choose browse tool
- unlock screen
- put "false" into globalCount
- put "" into cd fld "Question"
- put "" into cd fld "Answer"
- beep 1
- else
- if (the long time <> globalTime) then
- put the long date into globalDate
- put the long time into globalTime
- put globalDate into cd fld "Question"
- put globalTime into cd fld "Answer"
- lock screen
- reset paint
- choose oval tool
- set the filled to "true"
- set the pattern to "1"
- drag from "144,144" to "368,368" with optionKey
- put the itemDelimiter into oldDelimiter
- set the itemDelimiter to ":"
- put (word 1 of item 3 of globalTime) into theSecond
- put (((item 2 of globalTime) * 60) + theSecond) into theMinute
- put (((item 1 of globalTime) * 3600) + theMinute) into theHour
- set the itemDelimiter to oldDelimiter
- if (theSecond = "00") then
- play "harpsichord"
- end if
- choose line tool
- put ((2 * pi / 60) * theSecond) into theAngle
- set the lineSize to "1"
- drag from "256,256" to (256 + round(104 * sin(theAngle))),(256 - round(104 * cos(theAngle)))
- put ((2 * pi / 3600) * theMinute) into theAngle
- set the lineSize to "3"
- drag from "256,256" to (256 + round(88 * sin(theAngle))),(256 - round(88 * cos(theAngle)))
- put ((2 * pi / 43200) * theHour) into theAngle
- set the lineSize to "5"
- drag from "256,256" to (256 + round(72 * sin(theAngle))),(256 - round(72 * cos(theAngle)))
- choose browse tool
- unlock screen
- end if
- end if
- end if
- end idle
System Messages
- appleEvent
- on appleEvent class, id, sender
- -- statements
- end appleEvent
- closeBackground
- on closeBackground
- -- statements
- end closeBackground
- closeCard
- on closeCard
- -- statements
- end closeCard
- closeField
- on closeField
- -- statements
- end closeCard
- closeMovie
- on closeMovie movieName,windowID
- -- statements
- end closeMovie
- closePalette
- on closePalette paletteName,windowID
- -- statements
- end closePalette
- closePicture
- on closePicture pictureName,windowID
- -- statements
- end closePicture
- closeStack
- on closeStack
- -- statements
- end closeStack
- deleteBackground
- on deleteBackground
- -- statements
- end deleteBackground
- deleteButton
- on deleteButton
- -- statements
- end deleteButton
- deleteCard
- on deleteCard
- -- statements
- end deleteCard
- deleteField
- on deleteField
- -- statements
- end deleteField
- deleteStack
- on deleteStack
- -- statements
- end deleteStack
- errorDialog
- on errorDialog errorMessage
- -- statements
- end errorDialog
- enteringVRNode
- on enteringVRNode windowName,windowID,newNodeID
- -- statements
- end enteringVRNode
- exitField
- on exitField
- -- statements
- end exitField
- idle
- on idle
- -- statements
- end idle
- leavingVRNode
- on leavingVRNode windowName,windowID,oldNodeID,newNodeID
- -- statements
- end leavingVRNode
- mouseDoubleClick
- on mouseDoubleClick
- -- statements
- end mouseDoubleClick
- mouseDown
- on mouseDown
- -- statements
- end mouseDown
- mouseDownInMovie
- on mouseDownInMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseDownInMovie
- mouseDownInPicture
- on mouseDownInPicture windowName,clickLocation
- -- statements
- end mouseDownInPicture
- mouseEnter
- on mouseEnter
- -- statements
- end mouseEnter
- mouseEnterMovie
- on mouseEnterMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseEnterMovie
- mouseLeave
- on mouseLeave
- -- statements
- end mouseLeave
- mouseLeaveMovie
- on mouseLeaveMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseLeaveMovie
- mouseStillDown
- on mouseStillDown
- -- statements
- end mouseStillDown
- mouseStillDownInMovie
- on mouseStillDownInMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseStillDownInMovie
- mouseTriggerInMovie
- on mouseTriggerInMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseTriggerInMovie
- mouseUp
- on mouseUp
- -- statements
- end mouseUp
- mouseUpInMovie
- on mouseUpInMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseUpInMovie
- mouseUpInPicture
- on mouseUpInPicture windowName,clickLocation
- -- statements
- end mouseUpInPicture
- mouseWithin
- on mouseWithin
- -- statements
- end mouseWithin
- mouseWithinMovie
- on mouseWithinMovie windowName,windowID,mouseLoc,movieTime,{"vrHotSpot",hotspotID | "movie",movieID}
- -- statements
- end mouseWithinMovie
- moveWindow
- on moveWindow
- -- statements
- end moveWindow
- movieLinkToURL
- on movieLinkToURL windowName,windowID,pendingURL
- -- statements
- end movieLinkToURL
- movieRateChanged
- on movieRateChanged windowName,windowID,newRate
- -- statements
- end movieRateChanged
- movieTimeChanged
- on movieTimeChanged windowName,windowID,newTime
- -- statements
- end movieTimeChanged
- movieVolumeChanged
- on movieVolumeChanged windowName,windowID,newVolume
- -- statements
- end movieVolumeChanged
- newBackground
- on newBackground
- -- statements
- end newBackground
- newButton
- on newButton
- -- statements
- end newButton
- newCard
- on newCard
- -- statements
- end newCard
- newField
- on newField
- -- statements
- end newField
- newStack
- on newStack
- -- statements
- end newStack
- openBackground
- on openBackground
- -- statements
- end openBackground
- openCard
- on openCard
- -- statements
- end openCard
-
- openField
- on openField
- -- statements
- end openField
- openMovie
- on openMovie windowName,windowID
- -- statements
- end openMovie
- openPalette
- on openPalette paletteName,windowID
- -- statements
- end openPalette
- openPicture
- on openPicture windowName,windowID
- -- statements
- end openPicture
- openStack
- on openStack
- -- statements
- end openStack
- quit
- on quit
- -- statements
- end quit
- resume
- on resume
- -- statements
- end resume
- resumeStack
- on resumeStack
- -- statements
- end resumeStack
- sizeWindow
- on sizeWindow
- -- statements
- end sizeWindow
- spriteCustomAction
- on spriteCustomAction windowName,windowID,msgNumber,msgString
- -- statements
- end spriteCustomAction
- spriteDebugMessage
- on spriteDebugMessage windowName,movieID,message
- -- statements
- end spriteDebugMessage
- startup
- on startup
- -- statements
- end startup
- suspend
- on suspend
- -- statements
- end suspend
- suspendStack
- on suspendStack
- -- statements
- end suspendStack
Keywords
- do
- do statements [as scriptLanguage]
- end
- end {handlerName | if | repeat}
- exit
- exit {handlername | to HyperCard | repeat}
- function
- function customFunctionName [parameterList]
- global
- if-then-else
- if condition then statement [else statement]
- next repeat
- on
- on messageName [parameterList]
- pass
- repeat
- repeat {[forever] | for number [times] | until condition | while condition | with countVariable = start {to | down to} finish}
- return
- send
- send message [parameterList] [to {object | externalWindow}]
- send message [parameterList] to program programAddress [{with | without} reply]
Commands
- activate
- add
- add number to [chunk of] container
- answer
- answer [normal] prompt [with button1[ or button2[ or button3]]]
- answer file prompt [of type fileType1[ or fileType2[ or fileType3]]]
- answer folder [prompt]
- answer program prompt [of type programType]
- arrowKey
- arrowKey {up | down | left | right}
- ask
- ask [password [clear]] question [with defaultReply]
- ask file prompt [with defaultFileName]
- beep
- choose
- choose toolName tool
- choose tool toolNumber
- click
- click at location [with key1[,key2[,key3]]]
- close
- close [document {in | with}] application
- close file fileName
- close movie movieName
- close picture pictureName
- close printing
- close windowDescriptor
- commandKeyDown
- controlKey
- convert
- convert inputDateTime [from date [and time]] to date [and time]
- copy template
- copy template reportTemplate to stack stackName
- create
- create menu menuName
- create stack stackName [with background] [in [a] new window]
- debug
- debug {pureQuickDraw {true | false} | sound {on | off} | maxMem | maxWindows | hintBits}
- debug checkpoint
- delete
- delete {button | field | part | chunk of container}
- delete [menuItem {of | from}] menu
- dial
- dial phoneNumber [with modem [modemCommandString]]
- disable
- disable {button | [menuItem of] menu}
- divide
- divide [chunk of] container by divisor
- doMenu
- doMenu menuItem [,menuName] [{with | without} dialog] [with modifierKey[,modifierKey[,modifierKey]]]
- drag
- drag from start to end [with modifierKey1[,modifierKey2[,modifierKey3]]]
- edit script
- edit [the] script of object
- enable
- enable {button | [menuItem of] menu}
- enterInField
- enterKey
- export paint
- export paint to file paintFile
- find
- find [normal | chars | word[s] | string | whole] [international] text [in field] [of marked cards]
- flash
- functionKey
- get
- go
- go [to] {card | background | stack [in [a] new window]} [without dialog]
- go [to] {home | back | {next | prev[ious] | ordinal | any} [[marked] card]}
- help
- hide
- hide {window | part | titlebar | menubar | groups | movie}
- hide {backgroundPicture | cardPicture}
- hide menubar
- import paint
- import paint from file paintFile
- keyDown
- lock
- lock error dialogs
- lock messages
- lock recent
- lock screen
- mark
- mark {card | all cards | cards where condition}
- mark cards by finding [international] [findForm] findString [in field]
- movie
- movie [name[,windowStyle[location[,visible[,floatingLayer]]]]]
- multiply
- multiply [chunk of] container by divisor
- open
- open [document with] application
- open file filePathname
- open movie moviePath
- open picture picturePathname
- open printing [with dialog]
- open report printing [with {dialog | template templateName}]
- open URL url-string
- palette
- pause
- picture
- picture [name[,source[,windowStyle[,visible[,bitDepth[floatingLayer]]]]]
- play
- play sound {tempo tempo} {notesList}
- play stop
- play movie movieName
- pop
- pop card [{before | into | after} [chunk of] container]
- print
- print {text | container}
- print card [from topLeft to rightBottom]
- print [number | all | marked] cards [from topLeft to rightBottom]
- print document with application
- push
- push [card | background | stack]
- put
- put text [{before | into | after} [chunk of] container]
- put itemList [into | before | after] {menuItem of} menu {with menuMessage[s] messageList}
- read
- read from file filePathname [at {start | -offsetFromEnd] {until {char | end | eof} | for numberOfChars}
- reply
- reply replyString [with keyword replyKeyword]
- reply error replyString
- request
- request evaluation {of | from} programAddress
- request {ae | appleEvent} {class | ID | sender | returnID | data [{of | with} keyword AEkeyword]}
- reset
- reset menubar
- reset paint
- reset printing
- returnInField
- returnKey
- rewind
- run
- save
- save stack as stackCopyName
- select
- select [before | after] {text | chunk} of {field | message}
- select {part | line of popupButton | empty}
- set
- set [the] property [of object] to value
- show
- show {window | part | movie} [at location]
- show {backgroundPicture | cardPicture | titlebar | menubar | groups}
- show [numberOfCards | marked | all] cards
- show menubar
- sort
- sort [[marked] cards of] {[this] stack | background}] [direction] [sortType] by sortKey
- sort [{lines | items} of] container [direction] [sortType] [by sortKey]
- speak
- speak phrase [with {gender voice | voice voiceName}]
- start
- stop
- stop sound
- stop speech
- stop using stackToRemove
- subtract
- subtract number from [chunk of] container
- tabKey
- type
- type characters [with modifierKey1[,modifierKey2[,modifierKey3]]]
- unlock
- unlock error dialogs
- unlock messages
- unlock recent
- unlock screen [with visual [effect] effectName [speed] [to destinationImage]]
- unmark
- unmark {card | all cards | cards where condition}
- unmark cards by finding [international] [findForm] findString [in field]
- visual
- visual [effect] effectName [speed] [to destinationImage]
- wait
- wait [for] time [tick[s] | second[s]]
- wait {while | until} condition
- write
- write text to file filePathname [at {start | end | eof | -offsetFromEnd }]
Functions
- abs
- the abs of number
- abs(number)
- annuity
- annuity(interestRate,numberOfPeriods)
- atan
- [the] atan of number
- atan(number)
- average
- charToNum
- [the] charToNum of character
- charToNum(character)
- clickChunk
- the clickChunk
- clickChunk()
- clickH, clickV
- the clickH
- clickH()
- the clickV
- clickV()
- clickLine
- the clickLine
- clickLine()
- clickLoc
- clickText
- the clickText
- clickText()
- commandKey
- the {commandKey | cmdKey}
- {commandKey | cmdKey}()
- compound
- compound(interestRate,numberOfPeriods)
- cos
- [the] cos of angleInRadians
- cos (angleInRadians)
- date
- the [long | abbr[rev[iated]] | short | English] date
- date()
- destination
- the destination
- destination()
- diskSpace
- the diskSpace [of disk diskName]
- diskspace([disk diskName])
- exp, exp1, exp2
- [the] exp of number
- exp(number)
- [the] exp1 of number
- exp1(number)
- [the] exp2 of number
- exp2(number)
- foundChunk
- the foundChunk
- foundChunk()
- foundField
- the foundField
- foundField()
- foundLine
- the foundLine
- foundLine()
- foundText
- the foundText
- foundText()
- heapSpace
- the heapSpace
- heapSpace()
- length
- [the] length of string
- length(string)
- ln, ln1, log2
- [the] ln of number
- ln(number)
- [the] ln1 of number
- ln1(number)
- [the] log2 of number
- log2(number)
- max
- menus
- min
- mouse
- mouseClick
- the mouseClick
- mouseClick()
- mouseH, mouseV
- the mouseH
- mouseH()
- the mouseV
- mouseV()
- mouseLoc
- number
- [the] number of [card | background] {buttons | fields | parts}
- [the] number of backgrounds [{in | of} this stack]
- [the] number of cards [{in | of} {background | this stack}]
- [the] number of marked cards
- [the] number of {characters | words | items | lines} {in | of} string
- [the] number of {menus | menuItems {in | of} menu}
- [the] number of movies
- [the] number of {nodes | [video | sprite] tracks} {of | in} movie
- [the] number of {hotspots {of | in} node | scenes {of | in} track | sprites {of | in} scene {of | in} track} {of | in} movie
- number({menus|menuItems {in | of} menu})
- number(windows)
- numToChar
- [the] numToChar of ASCIIvalue
- numToChar(ASCIIvalue)
- offset
- offset(stringToLocate,stringToSearch)
- optionKey
- the optionKey
- optionKey()
- param
- [the] param of parameterNumber
- param(parameterNumber)
- paramCount
- the paramCount
- paramCount()
- params
- programs
- the programs [of machine macAddress]
- programs()
- random
- [the] random of upperLimit
- random(upperLimit)
- result
- round
- [the] round of number
- round(number)
- screenRect
- the screenRect
- screenRect()
- seconds
- the sec[ond]s
- sec[ond]s()
- selectedButton
- the selectedButton of [card | background] family number
- selectedChunk
- the selectedChunk
- selectedChunk()
- selectedField
- the selectedField
- selectedField()
- selectedLine
- the selectedLine[s] [of {popupButton | field}]
- selectedLine({[popupButton | field]})
- selectedLoc
- the selectedLoc
- selectedLoc()
- selectedText
- the selectedText [of {popupButton | field}]
- selectedText({[popupButton | field]})
- shiftKey
- sin
- [the] sin of angleInRadians
- sin(angleInRadians)
- sound
- speech
- sqrt
- [the] sqrt of number
- sqrt(number)
- stacks
- stackSpace
- the stackSpace
- stackSpace()
- sum
- systemVersion
- the systemVersion
- systemVersion()
- tan
- [the] tan of angleInRadians
- tan(angleInRadians)
- target
- the [short | abbr[ev[iated]] | long] target
- target
- ticks
- time
- the [long | abbr[ev[iated]] | short | English] time
- time()
- tool
- trunc
- [the] trunc of number
- trunc(number)
- value
- [the] value of factor
- value(expression)
- voices
- windows
Properties
- address
- the address [of HyperCard]
- allowBalloonHelp
- set [the] allowBalloonHelp of movie to {true | false}
- autoHilite
- set [the] autoHilite of button to {true | false}
- autoSelect
- set [the] autoSelect of field to {true | false}
- autoTab
- set [the] autotab of field to {true | false}
- backColor
- set [the] backColor of [spriteTrack of] movie to redValue,greenValue,blueValue
- badge
- set [the] badge of movie to {true | false}
- blindTyping
- set [the] blindTyping [of HyperCard] to {true | false}
- bottom
- set [the] bottom of {button | field | window | [object of] movie} to integer
- the bottom of {menubar | card}
- bottomRight
- set [the] bot[tom]Right of {button | field | window | [object of] movie} to point
- the bot[tom]Right of {menubar | card}
- brush
- set [the] brush [of HyperCard] to brushNumber
- buttonCount
- the buttonCount of window paletteWindow
- callbackMsg
- set [the] callbackMsg of movie to messageName
- callbackTime
- set [the] callbackTime of movie to time
- callbackWhenDragging
- set [the] callbackWhenDragging of movie to {true | false}
- cantAbort
- set [the] cantAbort of stack to {true | false}
- cantDelete
- set [the] cantDelete of {stack | background | card} to [true | false]
- cantModify
- set [the] cantModify of stack to {true | false}
- cantPeek
- set [the] cantPeek of stack to {true | false}
- centered
- set [the] centered [of HyperCard] to {true | false}
- characteristics
- the characteristics of track of movie
- checkMark
- set [the] checkMark of menuItem of menu to {true | false}
- closeOnFinish
- set [the] closeOnFinish of movie to {true | false}
- commandChar
- set [the] {commandChar | cmdChar} of menuItem to [character | empty]
- commands
- the commands of [{track | sprite | hotspot } of] movie
- the commands of window paletteWindow
- comments
- the comments of {node | hotspot} of] movie
- copyright
- currNodeID
- set [the] currNodeID of VRmovie to nodeNumber
- currTime
- set [the] currTime of movie to time
- cursor
- set [the] cursor [of HyperCard] to {cursorNumber | cursorName}
- cursorID
- set [the] cursorID of movie to resourceID
- debugger
- set [the] debugger [of HyperCard] to debuggerXCMD
- defaultNodeID
- the defaultNodeID of VRmovie
- defaultRect
- the defaultRect of [track of] movie
- dialingTime
- set [the] dialingTime [of HyperCard] to numberOfTicks
- dialingVolume
- set [the] dialingVolume [of HyperCard] to speakerVolume
- dithering
- set [the] dithering of pictureWindow to {true | false}
- dontErase
- set [the] dontErase of window movieWindow to {true | false}
- dontSearch
- set [the] dontSearch of {field | card | background} to {true | false}
- dontWrap
- set [the] dontWrap of field to {true | false}
- dragEnabled
- set [the] dragEnabled of movie to {true | false}
- dragSpeed
- set [the] dragSpeed [of HyperCard] to pixelsPerSecond
- duration
- the duration of [[scene of] track of] movie
- editBkgnd
- set [the] editBkgnd [of HyperCard] to {true | false}
- enabled
- set [the] enabled of {button | [menuItem of] menu | {hotspot | track} of movie} to {true | false}
- endTime
- set [the] endTime of movie to time
- the endTime of [scene of] track of movie
- environment
- the environment [of HyperCard]
- exporter
- set [the] exporter of [track of] movie to QTExportType
- exporters
- the exporters of [track of] movie
- family
- set [the] family of button to familyNumber
- fastIdle
- set [the] fastIdle of movie to {true | false}
- fieldOfView
- set [the] fieldOfView of VRmovie to angle
- fieldOfViewRange
- the fieldOfViewRange of VRmovie
- filled
- set [the] filled [of HyperCard] to {true | false}
- findTextCaseSensitive
- set [the] findTextCaseSensitive of movie to {true | false}
- findTextReverse
- set [the] findTextReverse of movie to {true | false}
- findTextStart
- set [the] findTextStart of movie to movieTime & return & trackNumber & return & charOffset
- findTextWraparound
- set [the] findTextWraparound of movie to {true | false}
- fixedLineHeight
- set [the] fixedLineHeight of field to {true | false}
- foundTextOffset
- the foundTextOffset of movie
- freeSize
- globalLoc
- set [the] globalLoc of pictureWindow to {point | mainScreen | cardScreen | deepestScreen | largestScreen}
- globalRect
- set [the] globalRect of pictureWindow to {left,top,right,bottom | cardScreen | mainScreen | largestScreen | deepestScreen}
- graphicsMode
- set [the] graphicsMode of {track | sprite} of movie to quickDrawMode & return & RGBColor
- grid
- set [the] grid [of HyperCard] to {true | false}
- hBarLoc
- set [the] hBarLoc of window "Variable Watcher" to number
- height
- set [the] height of {button | field | card | window | [controller of] movie} to integer
- the height of menubar
- hideIdle
- set [the] hideIdle of window "Message Watcher" to {true | false}
- hideUnused
- set [the] hideUnused of window "Message Watcher" to {true | false}
- highQualityMode
- set [the] highQualityMode of track of movie to {true | false}
- hilite
- set [the] [hilite | hilight | highlite | highlight] of button to {true | false}
- hilitedButton
- set [the] hilitedButton of window paletteWindow to buttonNumber
- icon
- set [the] icon of button to {iconName | resourceID}
- ID
- the [short | abbr[ev[iated]] | long] ID of {object | window | menu [track | scene | sprite | node | hotspot] of movie | HyperCard}
- idleFrequency
- set [the] idleFrequency of spriteTrack of movie to frequencyInTicks
- image
- set [the] image of sprite [of spriteTrack] of movie to {name | number}
- imageCorrection
- set [the] imageCorrection of VRmovie to {none | partial | full}
- imageCount
- the imageCount of scene of [track of] movie
- imageQuality
- set [the] imageQuality of VRmovie to {low | normal | high}
- information
- isVRMovie
- itemDelimiter
- set [the] itemDelimiter [of HyperCard] to character
- language
- set [the] language [of HyperCard] to {English | translatorName}
- set [the] language of movie to {languageName | languageNumber}
- the language of track of movie
- layer
- set [the] layer of {track | sprite} of movie to layerNumber
- left
- set [the] left of {button | field | window | [object of] movie} to integer
the left of {menubar | card}
- lineSize
- set [the] lineSize [of HyperCard] to thicknessInPixels
- linkDestination
- the linkDestination of hotSpot of [node of] VRmovie
- location
- set [the] loc[ation] of {button | field | card | window |[object of] movie} to point
- lockErrorDialogs
- set [the] lockErrorDialogs [of HyperCard] to {true | false}
- lockMessages
- set [the] lockMessages [of HyperCard] to {true | false}
set [the] lockMessages of movie to {true | false}
- lockRecent
- set [the] lockRecent [of HyperCard] to {true | false}
- lockScreen
- set [the] lockScreen [of HyperCard] to {true | false}
- set [the] lockScreen of movie to {true | false}
- lockText
- set [the] lockText of field to {true | false}
- longWindowTitles
- set [the] longWindowTitles [of HyperCard] to {true | false}
- loop
- set [the] loop of movie to {true | false}
- loopIsPalindrome
- set [the] loopIsPalindrome of movie to {true | false}
- markChar
- set [the] markChar of menuItem of menu to character
- marked
- set [the] marked of card to {true | false}
- mask
- set [the] mask of [track of] movie to {imageFileName | empty]
- matrix
- set [the] matrix of [{track | sprite} of] movie to {matrix | identity}
- menuMessage
- set [the] {menuMessage | menuMsg} of menuItem to messageName
- messages
- messageWatcher
- set [the] messageWatcher [of HyperCard] to messageWatcherXCMD
- missingComponents
- the missingComponents of movie
- movie
- set [the] movie of movieWindow to moviePath
- multiple
- set [the] multiple [of HyperCard] to {true | false}
- multipleLines
- set [the] multipleLines of field to {true | false}
- multiSpace
- set [the] multiSpace [of HyperCard] to spaceBetweenShapes
- mute
- set [the] mute of [audioTrack of] movie to {true | false}
- name
- set [the] name [of element] to newName
- the [English | short | abbr[ev[iated]] | long] name [of element]
- set [the] [English] name of menuItem of menu to newName
- the [English] name of menu
- nextLine
- set [the] nextLine of window "Message Watcher" to text
- number
- the [long | abbr[rev[iated]] | short] number of {part | card | bg | window | [object of] movie}
- number({field | button | card | bg | window | [object of] movie})
- numberFormat
- set [the] numberFormat [of HyperCard] to formatExpression
- owner
- the [long | short] owner of {window | card}
- the owner of [controller | [sprite of [scene of]] track of | [hotspot of] node of] movie
- panAngle
- set [the] panAngle of VRmovie to angleInDegrees
- panAngleRange
- the panAngleRange of VRmovie
- partNumber
- set [the] partNumber of {button | field} to number
- passMovieClick
- set [the] passMovieClick of movie to {true | false}
- pattern
- set [the] pattern [of HyperCard] to patternNumber
- pictureHeight
- the pictureHeight of pictureWindow
- pictureWidth
- the pictureWidth of pictureWindow
- polySides
- set [the] polySides [of HyperCard] to numberOfSides
- powerKeys
- set [the] powerKeys [of HyperCard] to {true | false}
- preferredLoc
- the preferredLoc of movie
- preferredRate
- the preferredRate of movie
- preferredSoundVolume
- the preferredSoundVolume of movie
- printMargins
- set [the] printMargins [of HyperCard] to left,top,right,bottom
- printTextAlign
- set [the] printTextAlign [of HyperCard] to alignment
- printTextFont
- set [the] printTextFont [of HyperCard] to fontName
- printTextHeight
- set [the] printTextHeight [of HyperCard] to pixelHeight
- printTextSize
- set [the] printTextSize [of HyperCard] to fontSize
- printTextStyle
- set [the] printTextStyle [of HyperCard] to styleList
- properties
- the properties of externalWindow
- the properties of [{track | scene | sprite | node | hotspot | controller} of] movie
- rate
- set [the] rate of movie to rate
- rectangle
- set the rect[angle] of {part | card | card window | [object of] movie} to left,top,right,bottom
- the rect[angle] of {window | menubar}
- reportTemplates
- the reportTemplates of stack
- right
- set [the] right of {button | field | card | window | [object of] movie} to integer
- the right of {menubar | card}
- scale
- set [the] scale of [{sprite | track} of] movie to {half | normal | double | fullscreen | horizScale [,vertScale]}
- set [the] scale of pictureWindow to integer
- scaleMedia
- set [the] scaleMedia of spriteTrack of movie to {true | false}
- script
- set [the] script of object to scriptText
- scriptEditor
- set [the] scriptEditor [of HyperCard] to scriptXCMD
- scriptingLanguage
- set [the] scriptingLanguage [of object] to scriptingLanguage
- scriptTextFont
- set [the] scriptTextFont [of HyperCard] to fontName
- scriptTextSize
- set [the] scriptTextSize [of HyperCard] to pointSize
- scroll
- set [the] scroll of scrollingField to integer
- set [the] scroll of window to horizOffset,vertOffset
- seeAllFrames
- set [the] seeAllFrames of movie to {true | false}
- sendMouseWithinMsg
- set [the] sendMouseWithinMsg of movie to {true | false}
- sharedHilite
- set [the] sharedHilite of backgroundButton to {true | false}
- sharedText
- set [the] sharedText of backgroundField to {true | false}
- showHotspots
- set [the] showHotspots of controller of VRmovie to {true | false}
- showLines
- set [the] showLines of field to {true | false}
- showName
- set [the] showName of button to {true | false}
- showPict
- set [the] showPict of {card | background} to {true | false}
- size
- the size of {stack | [ {track | sprite} of] movie }
- soundBalance
- set [the] soundBalance of soundTrack of movie to integer
- soundChannel
- set [the] soundChannel to channelNumber
- soundOutputComponent
- set [the] soundOutputComponent of soundTrack of movie to {componentName | componentNumber}
- soundVolume
- set [the] soundVolume of [track of] movie to level
- stacksInUse
- the stacksInUse [of HyperCard]
- startTime
- set [the] endTime of [track of] movie to time
- the endTime of scene of movie
- style
- set [the] style of part to style
- suppressHotspotNames
- set [the] suppressHotspotNames [of controller] of VRmovie to {true | false}
- suspended
- the suspended [of HyperCard]
- text
- set [the] text of window "Message Watcher" to text
- the text of track of movie
- textAlign
- set [the] textAlign [of HyperCard | of {button | field}] to alignment
- textArrows
- set [the] textArrows [of HyperCard] to {true | false}
- textFont
- set [the] textFont [of HyperCard | of message | of button | of {chunk of} field] to fontName
- textHeight
- set [the] textHeight [of HyperCard | of field | of button] to pixelHeight
- textSize
- set [the] textSize [of HyperCard | of message | of button | of {chunk of} field] to fontSize
- textStyle
- set [the] textStyle [of HyperCard | of message | of button | of {chunk of} field | of menuItem] to styleList
- tiltAngle
- set [the] tiltAngle of VRmovie to angleInDegrees
- tiltAngleRange
- the tiltAngleRange of VRmovie
- timeFormat
- set [the] timeFormat of movie to {SystemTime | MovieTime}
- timeScale
- titleWidth
- set [the] titleWidth of popupButton to pixelWidth
- top
- set [the] top of {button | field | window | [object of] movie} to integer
- the top of {menubar | card}
- topLeft
- set [the] topLeft of {button | field | window | [object of] movie} to location
- the topLeft of {menubar | card}
- traceDelay
- set [the] traceDelay [of HyperCard] to delayTicks
- type
- the type of [{track | node | hotspot | controller} of] movie
- useCustomCLUT
- set [the] useCustomCLUT of movie to {true | false}
- userLevel
- set [the] userLevel [of HyperCard] to levelNumber
- userModify
- set [the] userModify [of HyperCard] to {true | false}
- variableWatcher
- set [the] variableWatcher [of HyperCard] to variableWatcherXCMD
- vBarLoc
- set [the] vBarLoc of window "Variable Watcher" to number
- version
- the [short | abbr[ev[iated]] | long] version [of {service | stack | scriptingLanguage language}]
- version(service | stack | scriptingLanguage language)
- visible
- set [the] visible of {button | field | window | menubar | [{sprite | spriteTrack | controller} of] movie} to {true | false}
- wideMargins
- set [the] wideMargins of field to {true | false}
- width
- set [the] width of {button | field | card | window | [object of] movie} to integer
- the width of menubar
- zoom
- set [the] zoom of pictureWindow to {in | out}
- zoomed
- set [the] zoomed of card window to {true | false}
- the zoomed of window
Operators
Arithmetic operators
Comparison operators
- =, is
- <>, is not
- <
- >
- <=
- >=
- contains
- is in
- is not in
- is within
- is not within
Logical operators
String operators
Type and existence operators
- is a
- data is [not] a[n] {number | integer | point | rect[angle] | date | logical}
- there is a
- there is [a[n] | not a[n] | no] {object | window | picture | disk | folder | file | movie | scriptingLanguage | application | document | menu | menuItem | program}
Constants
- colon
- comma
- down
- empty
- false
- formFeed
- lineFeed
- pi
- quote
- return
- space
- tab
- true
- up
- zero
- one
- two
- three
- four
- five
- six
- seven
- eight
- nine
- ten
Sample Multiple Choice Questions & Answers
Questions
- Which one of the following commands is equivalent to (lock messages)?
- set the lockMessages to true
- set the lockMessages to false
- set the lockMessage to true
- set the lockMessage to false
- Which one of the following commands is illegal?
- go next
- go to next
- go next cd
- goto next cd
- Which one of the following commands has a wrong syntax?
- put the English name of this cd into theName
- put the international name of this cd into theName
- put the short name of this cd into theName
- put the long name of this cd into theName
- What does comparison ("A" = "B") yield?
- false
- true
- 0
- 1
- What does function sin(0) return?
- 0.5
- 1
- 0
- -1
Answers
- a
- d
- b
- a
- c
Bibliography
- Listed below, in no specific order, are the sources from which this study guide was constructed. In most, but not all, the selections were made from the latest editions available to the author. Needless to say, the author and editors assume no responsibility for the accuracy with which these sources were originally printed. This list therefore, is neither critical nor annotated; it is included for the convenience of the student.
- Getting Started: With HyperCard
- Apple Computer, Inc.
- 1995
- HyperCard: Reference Manual
- Apple Computer, Inc.
- 1993
- HyperCard: Script Language Guide
- Apple Computer, Inc.
- 1993
- HyperTalk 2.2: The Book
- Dan Winkler, Scot Kamins, and Jeanne DeVoto
- Random House, Inc.
- 1994
- ISBN 0-679-79171-X
- The Complete HyperCard 2.2 Handbook
- Danny Goodman
- Random House, Inc.
- 1993
- ISBN 0-679-79122-1
- HyperGames
- <http://WWW.HyperInfo.CA/HyperGames/>
- <mailto:Comments@HyperInfo.CA>
- HyperInfo Canada Inc.
- 1998
- ISBN 0-929105-25-7