HyperActive Software

Home What's New Who We Are What We Do Solutions Resources

We make software for humans. Custom Mac, Windows, iOS and Android solutions in HyperCard, MetaCard, and RunRev LiveCode


HyperCard Tips and Tricks: Behavior and Operation

Breaking into the debugger

Posted: 9/9/99
You can drop into the debugger at any time while a script is running by
typing option-command-period. The debugger will stop on the line of
script currently being executed.

You can also break into the debugger when an "answer" or "ask" dialog
is on screen. Type the same key combination, then click one of the
buttons in the dialog. As soon as the dialog disappears, you will drop
into the debugger.

Jacqueline Landman Gay
HyperActive Software

Creating a new, but identical, background

Posted: 5/24/98
Copying a card, changing a card property such as "dontSearch", and then 
pasting in the new card, will create the new card with a new

Another way to create a new background is to change a shared field
after copying the card but before pasting it.

Karl Petersen

QT changes text file type and creator

Posted: 5/24/98
When you use HyperCard 2.3.5 to create a new text
file with the "open file " command, QuickTime 3 will look at
that file to see if it has a suffix relating to QuickTime, for example
".gif". QuickTime 3 then instructs Finder to modify the files based on
their suffixes. The files' creator and type is then changed to conform
to the suffix.

This behavior is controlled by a setting in the QuickTime Settings
control panel. Open that control panel and select the QuickTime
Exchange panel. Uncheck the box labeled "Enable QuickTime Exchange".
Restart your machine, and your new files will remain TEXT/ttxt files.

Paul Foraker
White Feather Software

Undocumented HC 2.4 Script Editor tricks

Posted: 5/24/98
A few script editor changes didn't make it into the HyperCard 2.4
Read Me file.  Here is a summary:

 - Not everyone likes losing the area in the window occupied by the
   menus, so the script editor removes them if the HyperTalk global
   "scriptHidePopups" is true.

 - Not everyone likes the "annoying flashing" of the script's length
   label, so the label is not drawn if the HyperTalk global
   "scriptHideLengthItem" is true. 

 - Cmd-E grabs the selected text for the "find" string (the same as
   cmd-H but without doing a search).

 - The HyperTalk global "scriptReverseSearch" controls the search
   direction. Holding down the shift key while doing a search toggles
   the search direction for that search only.

Eric Carlson
Apple Computer

Presetting filepaths

Posted: 3/24/98
In the Home stack there are paths stored that let HyperCard know where
to find files and stacks. Normally, once you have used a document,
HyperCard remembers where it was, and therefore doesn't ask you for it
the next time. You can avoid having HyperCard ask you where a document
is even if its path is not stored in the Home stack.

HyperCard stuffs those paths into three variables, Stacks,
Applications, and Documents. In your OpenStack handler you could append
the paths your program might need to those variables. As an easy example,
if you have a CD-ROM that holds the QuickTime movies in a folder, and
the HyperCard application is run from somewhere on the user's hard disk,
the openstack handler could include:

  global documents
  put "my cd:movies folder:" into mymovies
  if mymovies is not in documents then put documents & return & mymovies into documents

Checking to see if documents already contains your movies path is just
to make sure you don't keep on appending your path to the documents
variable everytime that there is an openstack that day.

Colin Holgate

Paint text limits

Posted: 3/24/98
HyperCard's paint text is limited to 100 characters per line and 20

Jacqueline Landman Gay
HyperActive Software

Requesting a disk insert

Posted: 3/24/98
You can prompt the user to insert a particular disk, if you can access
the diskettes ahead of time, by using an alias. HC 2.3 lets you do
something like this (where the alias to the diskette is stored on your
hard drive):

   on mouseUp
     insertDisk "Sample Diskette"
     if the result is empty then
        -- do something with that disk
     end if
   end mouseUp
   on insertDisk diskName
     if NOT (there is a disk diskName) then
       put "Mac HD:My Folder:" & diskName && "alias" into aliasPath
       if NOT there is a file aliasPath then
         return "Alias not found"
       end if
        -- next shows "Please insert disk:"
       open file aliasPath
     end if
     if NOT (there is a disk diskName)
     then return "Cancel"
   end insertDisk

Karl Petersen

Bypassing the 32K script limit

Posted: 1/16/98
A way to bypass the 32K script limit is to split up the scripts and put
a "send" handler in the script which is about to overflow, which
sends the message to another object like the script of a button.
For example, the background script is almost full and I need a handler
"showEditor" which can be called all over the background. I put the
actual handler in the script of a background button "xScripts1", and in
the background script I put the following script:

 on showEditor
  send the params to bg btn "xScripts1"
 end showEditor

"the params" includes the "showEditor" command as well as all the
parameters passed to "showEditor". There is one caveat here: when using
"send", the parameters are evaluated before sending. This means that
the following command will cause problems:

    showEditor "line1"&return&"line2",param2

because what the xScripts1 button will receive, is:

  showEditor "line1"
  "line2",(the value of param2)

and the command gets split into two lines. The same thing happens with
"quote". The only way to get round this is include a script in the
passing handler which parses all parameters so that they are sent under
the form 'quote&"text1"&return&"text2"...'

Alexander Thomas

Quick one-off scripts

Posted: 1/16/98
Here's a quick way to write a temporary script for something you are
only going to do once, such as moving all the buttons on a card, or
collecting a one-time list. You don't even need to open the script

Show the Variable Watcher window. If you don't already have one, type
"get it" into the message box to create a global "it" variable.
In the Variable Watcher, load the value of "it" with your list of
commands. Your temporary script can be as many lines as you like. (Omit
any "on" or "end" handler lines, just list the actual command lines.)
You can use if-then conditionals, repeat loops, or any other valid
HyperTalk syntax. Next type "do it" into the message box. The commands
will run and there won't be a script left over to remember to erase

It is also possible to paste multiple command lines into the message
box and hit the return key to accomplish the same thing, but to do so,
you have to first type the commands into a script or a text editor
before you can paste them. Using the Variable Watcher shortens the
process to one step.

Jacqueline Landman Gay
HyperActive Software

TextArrows only in fields

Posted: 1/16/98
You can turn the arrow keys on while typing in fields, but off the rest
of the time, with this:

on arrowKey
  set the textArrows to (the selectedChunk is not empty)
  pass arrowKey
end arrowKey

Don't recall where I got this but it could have been from HyperTalk 2.2
The Book. I use it as an "else" statement with all the other arrowKey

Jim Frimmel
Program Manager, Monitoring Times Magazine

Double-clicking the scroll window

Posted: 12/6/97
Double-clicking on the viewing rectangle in the Scroll window restores
the viewing area to the entire card (if there is enough memory.) Another 
double-click in the rectangle shrinks the viewing area to its previous
smaller size.

Jacqueline Landman Gay
HyperActive Software

What's on the clipboard?

Posted: 12/5/97
Since HyperCard faithfully manages the clipboard behind the scene,
HyperTalk can easily and reliably remind you what is there to be

   function ClipBoardType
     -- ex: the fifth menu item of menu Edit reads something like:
     --     "Paste Picture", so...
     return (word 2 of menuitem 5 of menu "edit")
   end ClipBoardType

Of course, the function assumes that the top five menuitems of menu
Edit have not been changed. Otherwise, you just take the longer but
safer scripting route...

   if there is a menuitem "Paste Picture" of menu "Edit"
   then return "picture"
   else if   -- etc...

Bernard Saulnier
Research Scientist, Hydro-Qu┼Żbec Research Institute

Long window titles

Posted: 11/24/97
HyperCard can get confused if you have multiple copies of a stack in
different folders or on different disks. Unless long stack names are
used in go statements, it's not always clear which of several
identically named stacks a "go stack" command will navigate to. It
would be nice to be able to check where you are.

Set the longWindowTitles property to true. When it is true the title
bar of the stack window contains the long name of the stack. Note this
is only useful when the titleBar of the stack window is visible.

Brett Sher

Exporting to text files

Posted: 11/24/97
Given that hard disk access is much slower than RAM acess, writing to
disk frequently can slow down an export.

Repeatedly writing records of a few Kbytes per record to disk is
inefficient. However, concatenating your data into a single buffer
variable and then writing it to disk all at once is also inefficient.
This is because, as the buffer variable grows in length, HyperCard
takes ever longer to perform a concatenation. Additionally, having a
large buffer variable in RAM taxes HyperCard's memory usage. In the
worst case, HyperCard can crash if the buffer grows too large.

The solution is to find a compromise that will allow the use of a
buffer to cache records, but not allow the buffer to grow to an
unmanageable size. If data records tend to be fairly uniform in length, 
the buffer can be flushed (written to disk and then emptied) at regular 
intervals (for exmple, every time it contains 10 records.) If the
length of data records is less uniform, the buffer size can be
monitored and the buffer flushed only when it is about to exceed some
arbitrary maximum size.

Brett Sher

Double-clicking phrases in the script editor

Posted: 11/24/97
For years now I've been double-clicking just after the leading quote
mark of a quoted phrase to select the entire phrase. For example:

  This is a "quoted phrase" to select.

If you double-click immediately after the first quote mark, you get the 
entire phrase selected, without the quote marks. (Only works in the
Script Editor, not in a field.)

With parenthetical expressions, it works differently. If you
double-click after the leading parenthesis, you get just the first word 
selected. However, if you double-click immediately before the trailing
parenthesis, you select the entire expression. For example:

  This is (a parenthetical expression) to select.

Double-clicking between the "n" & ")" gets you
"a parenthetical expression" selected, without the parentheses.

Paul Foraker
White Feather Software

You can also double-click just in front of a quote mark or parentheses
to select the inner text. -- Jonathan Cooper

"Handler Too Long" error

Posted: 11/24/97
The 'Handler too long' message pops up whenever the executable code
that HyperTalk generates when compiling your handler exceeds its limit
-- which is currently 32K. The HyperTalk compiler for Macintoshes with  
680x0 microprocessors generates 68000 instructions, while the HyperTalk 
compiler for Macintoshes with PowerPC microprocessors generates
pseudocode that requires fewer instructions per operation. Therefore
you can get away with slightly longer handlers in one version of
HyperCard than you can in the other.

Kevin Calhoun
Apple Computer, Inc.

Menu itemdelimiter can be set

Posted: 11/24/97
When setting up menuItems from a script, you can set the itemDelimiter
to whatever you want before passing the list of menu items to
HyperCard. So if the itemDelimiter is "/", then passing
"Menu One/Menu Two/Menu Three" when setting the contents of a menu will 
give you menu items:

 Menu One
 Menu Two
 Menu Three

just as though you had comma-delimited the list.

Jason White

Cmd-Delete card deletion has undo

Posted: 11/24/97
Command-Delete deletes a card without warning. However, in version 2.2
or higher, Undo works, so you can recover easily. However, while the
Command-Delete generates the  proper closeCard, deleteCard messages,
the Undo doesn't generate any messages at all, making it impossible to
tell from a script that the user did this.

Jon Pugh

Preventing text pickup

Posted: 11/24/97
There is a way to stop text from going into the message box when you
command-click in a field. You can put the following handler into the
script of the field:

on mouseDown
  click at the mouseLoc
end mouseDown

This handler could be useful if you want unlocked fields to respond to
mouse clicks, while maintaining access to the message box.

Alain Stalder

Actually, scripting a click anywhere (for example, at "0,0") works too.
-- jg

When "Quit" menuitem won't work

Posted: 11/24/97
HC requires that all xWindows close before HyperCard Quits. In other
words, if you have an xWindow open  when you Quit HyperCard, HC will
send the window a "close" message before HC Quits. If the window fails
to respond properly to that message, HC won't Quit. And it won't tell
you of the window's error.

Karl Petersen

Hiding window at startup

Posted: 11/24/97
You can hide the card window at startup before it is displayed. The
name of the window in which your stack is displayed is usually just the 
name of the stack.  At startUp time (i.e., when the startUp system
message is sent), that window has A) yet to be displayed and B) yet to
be named.  So, one must refer to it as window "Card". For example:

on startUp
  set the loc of window "Card" to 100,100
end startUp

will center the window at 100,100 when it is displayed.

James Beldock
Cogito Software

Or "card window". -- jg

Why stacks open in small windows

Posted: 11/24/97
There are several reasons for getting large stacks opening up in small

1. not enough memory allocated to HyperCard 
2. you opened a colorized stack first then tried to open a larger 
stack (colorized or not) 
3. you opened a color PICT with the Picture XCMD, then tried to open 
a larger stack 
4. you opened a small stack, then used the Open Stack menu item
in the File menu to open a larger stack

All of those ways of getting small windows for large stacks are nasty,
egregious bugs that are not, however, bugs in HyperCard so for the
moment we're stuck with them.

The workaround is to open your largest (meaning window-size, not number 
of cards) stack first.

Paul Foraker
White Feather Software

When is there a stack?

Posted: 11/25/97
If a stack exists, this usually returns TRUE:

    there is a stack "Sample Stack"

But if "Sample Stack" is already open in another application it returns 
FALSE. When the stack is open in ResEdit, for example. Or open in
another version of HyperCard. Or open in a standalone.

On the other hand, this returns TRUE, even when a stack is open in
another app:

    there is a FILE "Sample Stack"

1. if a *stack* is open in another app, the stack doesn't exist.
2. but if a *file* is open is another app, it continues to exist.

Karl Petersen

Fast menu changes

Posted: 11/24/97
Hiding the menubar when altering the menus will speed up menu

   on customMenu
     lock screen
     hide menuBar
     -- customize menus here
     show menuBar
   end customMenu

Brett Sher

Quick message box text entry

Posted: 11/24/97
If you are typing in a field, or you have an object selected, and you
need to type a command in the message box, instead of picking up the
mouse and clicking in the message box, just type Cmd-M to hide it,
Cmd-M to show it again, and start typing. What you type will go into
the message box.

This also works if your insertion point is in the message box and you
want to start over. In HyperCard 2.2, if your insertion point is
blinking in the message box and you want to replace what's there, just
type Cmd-A (Select All) and start typing.

When your insertion point is in a field, you can also type Enter
followed by Delete. THis gives you a blinking insertion point in the
message box, as well as empties it.

Paul Foraker
White Feather Software

The Clear key will also empty the message box, but does not place the
insertion point. -- jg

How private access works

Posted: 11/24/97
Private Access can't be removed. Setting the Private Access button
scrambles the stack header randomly based on the password.  Without the 
proper password, you can't unscramble the header, and you can't access
the stack.  You can still pull all of your scripts out with an editor
that can open anything (like BBEdit), but the stack layout is

Jon Pugh

Up to top | HyperCard Tips and Tricks