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: AppleScript

Adding AppleGuide to stacks

Posted: 1/16/98
You can add an Apple Guides to your HyperCard stack by using the
following method.

(1) Create an Apple Guide using the Apple Guide Start Kit (Danny
Goodman -- comes with his book) or see the AppleGuide FAQ at
http://rampages.onramp.net/~stepup/ag_faq/agfaq.html for additional

(2) Add a script to a button, set scripting language to AppleScript,
put this script into it:

  on mouseUp
    tell application "Apple Guide"
      Open Database "Macintosh HD:HyperCard 2.4 B9:myguidename"
     end tell
  end mouseUp

Using this method the full path to the guide needs to be stated.

If you install the guide in the into the Extensions folder you may
simply put the name of the Guide, vis: 

   Open Database "myguidename"

Ideally the Guide would appear under the Help menu (which under System
8 is not a hypercard menu).  I don't know how this could be done.

Note: if you are creating a standalone, you don't need to use the above
method (although you can if you wish), instead you may create a guide
which will appear in the usual way under the help menu.

Rodney Tamblyn
ETSS, University of Otago


Catching AppleEvent errors

Posted: 12/20/97
Applevent handlers, like external windows, can be baffling because
they give no error dialog when calling a faulty script -- the script
simply gives up. One way to get some feedback is to insert the
following handler in the stack script:

on errordialog a
  answer a
end errordialog

This will at least report the nature of the error.

Roger Lainson
SDR Clinical Technology


Program linking log-in dialogs

Posted: 12/5/97
The first time hypercard establishes a link with a target program, it
presents a login dialog asking for the user's name and password. One way
around this is to use the two AppleScript scripting additions
"login as" and "logout" from the GTQ 1.2 library to avoid the dialog.
They're hacks that will break at some point, but they've been
working well and continue to do so in Mac OS 8. You can get the GTQ


Jon Pugh


Button Tasks need AppleScriptLib

Posted: 11/24/97
There's a known problem with HyperCard 2.3 that prevents Button Tasks
from appearing on Macintoshes with PowerPC microprocessors if the
AppleScriptLib file is not present.  If this is the case in your lab,
installing AppleScript on each of the machines should make the problem
go away.  You don't need the full AppleScript implementation for
Button Tasks to work; if you want, you can remove all of it except for

Kevin Calhoun
Apple Computer, Inc.


Activating HC with AppleEvents

Posted: 11/24/97
You don't actually need AppleScript to use the 'activate' command in
HyperCard. Although it's not documented, 'activate' is also a HyperTalk
command, starting with HyperCard 2.2. Try this:

  on mouseUp
    doMenu "Finder"
    wait 2 seconds
  end mouseUp

Kevin Calhoun
Apple Computer, Inc.


AppleScript script limits

Posted: 11/24/97
You can store compiled AppleScripts which are less than 32K in size in
any Hypercard (2.2 & 2.3) object.  That's the size of the compiled
AppleScript, which is larger than simply the text.  You can't really
tell how much larger, and this size includes all the property data.

The compiled AppleScript is being stored in the HyperTalk script field, 
and since that is limited to 32K, so are the AppleScripts.  My rough
tests indicate that a 7K script can easily create a 32K compiled

So, what are your options in the face of this awful limitation?

1) Write short AppleScripts.  Simple, but not very practical.

2) Store AppleScripts in a bunch of buttons or fields on a card and
have a HyperTalk dispatcher in the stack, background or card resend the 
messages to the buttons or fields.  Complex but workable.

3) Store the AppleScripts in resources and use Jon's Commands (a
scripting addition) "run script resource" command to only have little
wrapper routines in your stack.  Complex and requires special
installation and mucking with resources.  An advantage is that you can
store the scripts "run only" which makes them smaller and no longer

4) Store the AppleScripts as text and compile them as needed with the
"do" command.  Complex and slow.

Jon Pugh

Up to top | HyperCard Tips and Tricks