O'Reilly logo

Beginning Mac OS® X Programming by Drew McCormack, Michael Trent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.4. AppleScript

Many different scripting solutions are presented in this chapter, but only one can easily be used to script applications with graphical interfaces: AppleScript. AppleScript was created by Apple in the old days of Mac OS, but is now well supported on Mac OS X, and has even been extended to allow fully functional applications to be developed with AppleScript Studio.

10.4.1. Why AppleScript?

AppleScript is not only different than other scripting languages because its main purpose is scripting applications with a graphical interface, but it also looks a lot different because it is targeted not at programmers, but ordinary Mac users. The language reads to a large extent like English. This is a boon for the non-programmer, but some experienced programmers may be put off by the verbosity of the language, and the degree of redundancy; you can often choose between several different constructions to perform a single task in AppleScript.

In the latest versions of Mac OS X, AppleScript can also be used to develop complete applications, with AppleScript Studio (see Chapter 12). AppleScript Studio is included with Apple's development tools and doesn't cost a penny. Using AppleScript Studio, you can add a Cocoa user interface to your scripts, making it easy for non-programmers to develop Mac OS X applications that are indistinguishable from those written natively in Objective-C.

If you want to script your Mac OS X applications, you will want to use AppleScript, but for other ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required