Scripting Fundamentals

AppleScript support is built-in to the Mac OS, so it doesn’t require a special command interpreter to play back your AppleScript command files. It also doesn’t require a special program to create your scripts—you can write an AppleScript in any text editor as long as you subsequently set your script’s type to OSAS and its creator to ToyS. However, OS X includes a special program called Script Editor, which has some nice features. For example, the Script Editor understands the syntax of the AppleScript language, so it can automatically highlight AppleScript keywords, check the syntax of your AppleScripts before you save them, and automatically set the right file type and creator information. If you use another application to create AppleScripts in text format, you must use the Script Editor to compile them and save them in compiled script format so they can be used by applications that expect this format. You also have to use the Script Editor if you want to compile your AppleScripts into standalone applications.

Though I’m a big AppleScript fan, AppleScript support still has room to grow on Mac OS X. If you’ve used AppleScript before, you’ll find that some capabilities aren’t available yet under OS X. The most irritating omission is that the Finder is not currently recordable, which means that the Script Editor can’t automatically write standard file/folder manipulation scripts for you by keeping track of your actions in the Finder under OS X. When running under Mac OS 9, for example, you can tell the Script Editor to watch your actions as you create files and folders in the Finder and move them around, and the Script Editor will automatically generate AppleScript code. The OS X Finder doesn’t support this capability yet. For now, to create an AppleScript that uses Finder commands, you must either create one in the Script Editor, or boot your system in Mac OS 9 and use its Script Editor there.