Workshop #1: Introduction to AppleScript

About This Workshop

This workshop, like the O'Reilly "In A Nutshell" books after which it is named, is designed for users who want to learn some AppleScript quickly and easily, and already have a background in programming or scripting with other languages. It covers the parts of the language and their uses in a defninition-based context, using simple examples. Since this workshop is designed to cover the basics of the language quickly, it also includes a bit of complementary information from Workshops #2 and #3, again in the same straightforward fashion.

If you have no experience with other programming languages or object-oriented design, or would prefer a more example-driven approach with scripts that perform real activities instead of dummy placeholder statements, see the beginner version of workshop #1.

About AppleScript

With the release of System 7 in 1991, Apple introduced a technology called AppleEvents onto the Macintosh scene. These were a for of high-level system events that could be used for interapplication communication. Developers could incorporate AppleEvents into their applications to allow them to share their data with or be controlled by other applications. With System 7.1 Pro, Apple created a framework for scripting languages to be built upon the AppleEvent Object Model: this framework is called the Open Scripting Architecture, and the first OSA scripting language was AppleScript. As of System 7.5, AppleScript is included as a default component of the Mac OS. More recent system releases have seen major enhancements to AppleScript and the OSA--most notably Mac OS 8.5, which for the first time executes AppleScripts as native PowerPC code, and Mac OS 9.0 which allows for AppleScripts to communicate over TCP/IP.

AppleScript is a language interface to the Macintosh; it transcends the limitations of most macro utilities and scripting languages to allow automation of repetitive or complex tasks and generation of custom solutions using separate applications or even separate computers. Some of its new abilities allow for such possibilities as creating an icon on your desktop where you can drop files and have them sorted, renamed, entered into a database, and uploaded to a web server. Or an interactive survey application that uses text-to-speech and speech recognition to interview the subject. Or a menu command that can search a directory server and automatically enter a person's contact information into your personal information manager, then sync it with your Palm device if it's connected. All these and more are possible with AppleScript.

You can get more information about AppleScript, including example scripts, other tutorials, and links to complementary third-party products, from Apple's AppleScript web site at http://www.apple.com/applescript/. If you're running Mac OS 8.5 or greater, you can also use AppleScript Help, which can be found in the Help menu when you're running Script Editor, or in Help Center.

Now, let's get started...

Next: The Script Editor


Copyright 1999 MacWarriors, ACM@UIUC