Appendix B. Moving from HyperCard to AppleScript


Back in the days before DVDs, iPods, and take-out sushi, everyday Mac fans used HyperCard to write simple automation programs. Sure, HyperCard couldn't command other programs, but its simplicity and power made HyperCard a favorite tool for thousands of budding programmers.

In addition, HyperCard was one of the first programming tools to let people build their program's interface through drag-and-dropmore than a decade before Interface Builder came along. HyperTalk, the programming language for HyperCard, was highly regarded for its English-like syntax and shallow learning curve. And even hard-core programmers respected HyperCard stacks (interfaces bundled with code) for their small file size.

Unfortunately, Apple stopped supporting HyperCard soon before releasing Mac OS X. If you happen to be one of the Mac fans who depends on HyperCard for everyday work, therefore, you're left with only a few choices:

  • Continue using HyperCard in Mac OS X's Classic mode. Classic is Apple's buzzword to describe Mac OS 9 programs running in Mac OS X. Unfortunately, since HyperCard wasn't designed for Mac OS X, using HyperCard in Classic is likely to result in a major slowdown of your code. Plus, you'll continue to see HyperCard's old, gray, Mac OS 9-style windowsa scourge on the attractive interface of Mac OS X.

  • Buy a Mac OS X program that can open HyperCard stacks. Such programs include SuperCard ($180, www.supercard.us) and Revolution ($150-$900 depending on license, http://revolution.runrev.com/). Unfortunately, neither program is perfect at importing HyperCard stacks into Mac OS X, so you may have to spend a while updating sections of code to be Mac OS X-compatible.

  • Rewrite your HyperCard stacks with AppleScript. Since AppleScript and HyperTalk are fairly similar languages, you can rewrite your HyperCard stacks in AppleScript pretty easily.

If your HyperCard stacks are full of interface elements, you'd probably be better off rewriting your stacks in AppleScript Studio (Chapter 15) than simply reprogramming your stacks in Script Editor. That's because plain ol' AppleScript doesn't allow for complex interfaces.

On the other hand, if your HyperCard stacks are simple (say, just based around a button or two) it's easier to rewrite your code in Script Editor than to deal with the complexities of Xcode and Interface Builder (Section 15.2).

If you decide to pursue the converting-to-AppleScript route, you'll be glad to have the rest of this appendix at your side. The following pages address the most common syntax differences between HyperTalk and AppleScript, so you can bring your stale code from the confines of Mac OS 9 to the bright, shining future of Mac OS X.

The rest of this appendix assumes that you know how to program in HyperCard proficiently. There's no explanation of what specific HyperTalk commands do, because you can find in-depth explanations in a book like The HyperTalk Language Guide (Addison Wesley, 1988).

If you don't know HyperCard, though, don't sweat it. HyperCard is unsupported by Apple, and there's little reason to create new programs with it unless you're nostalgic for the era of black and white Macs.



AppleScript. The Missing Manual
AppleScript: The Missing Manual
ISBN: 0596008503
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net