O'Reilly logo

AppleScript: The Missing Manual by Adam Goldstein

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

Script Formats

When you double-click one of the scripts in, say, your Library Scripts Finder Scripts folder,Script Editor opens a new window containing the AppleScript code for that script. On the other hand, if you double-click one of the scripts in your Library Scripts ColorSync folder, the script itself runs rather than opening up in Script Editor.

That might seem like a minor difference, but it highlights an important fact of AppleScript life: scripts come in different formats. If you hope to make it through the jungle of AppleScript files available on the Web (Section C.1)—and, perhaps, to post your own scripts there—you first have to understand the different formats AppleScript supports.

You can open any AppleScript-supported file by dragging it onto Script Editor's icon in the Finder or Dock. To save a script in a different format, you use the File Format pop-up menu in the Save dialog box (Figure 2-5).

There are three main formats:

  • Script files, which get a .scpt file extension.

  • Applications, which get a .app file extension (just like regular Mac OS X programs).

  • Text documents, which get the lengthy .applescript file extension.

Note

Two other minor formats—called bundles—are also available. Page Sidebar 2.5 explains how and when to use these.

The following sections give you a better idea of when you should save a script as a particular script type.

The File Format pop-up is available whenever you choose Save or Save As from Script Editor's File menu. The other options in this dialog box are available only for certain formats; you can set the Line Endings, for instance, only if you're saving the file as Text.

Figure 2-5. The File ...

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