AppleScript is the companion product to the Mac Aqua graphical user interface (GUI). The two work to allow developers to script and run solutions that work with the Mac OS X interface. By using AppleScript, you can communicate easily with products such as QuickTime, databases, networks, web services, and more.
Greater than 80 percent of all the applications built for OS X leverage AppleScript as an automation tool. This article introduces AppleScript and describes how to leverage it for your applications.
The Bigger Picture
The first check you have to make is where AppleScript falls in the big picture of OS X. If this is the first time you are investigating programming within OS X, you are about to have your eyes pulled wide open. There is a lot that gets done under the hood.
You can think of OS X as having four levels:
- Level 1: The bottom level is chip. OS X is chip agnostic by design. Which is good because Apple just announced that the PowerPC will be replaced by the Intel chip set.
- Level 2: Foundation graphical tools are controlled by Quartz, OpenGL, QuickTime, and Audio.
- Level 3: The hardcore programmers are developing Xcode, Cocoa, Java, and Carbon solutions.
- Level 4: Aqua GUI and AppleScript.
The topmost level is where you use AppleScript. AppleScript is a tool many Mac software developers use to allow you to add quick automation programs to your solutions. It can be used to build solutions, but the real value of AppleScript comes when you use it to automate tasks. The scripts you write can interact with other scripting languages and applications. This is all achievable through what Apple calls the Open Scripting Architecture—a layer within the OS that exposes events that can be communicated to AppleScript. AppleScript can then enable you to interact with this process without having to learn a verbose language such as C, Java, or Xcode.