DekGenius.com
Team LiB   Previous Section   Next Section

Chapter 2. Using Script Editor with OS 9 and OS X

Unless you decide to use a commercial development environment to create scripts, the free Script Editor will be your principal AppleScripting tool.[1] This is fine; many AppleScript purists have clung to Script Editor and still find it easy to use, even though it hasn't changed that much in years. Besides, it's free with the Mac OS 9 and OS X installation. You can find Script Editor in the /Applications/AppleScript folder in Mac OS X; in OS 9, this application is located in startup disk:Apple Extras:AppleScript.

[1] Smile is a free AppleScript tool that can be downloaded from http://www.tandb.com.au/smile. Three commercial development environments are Digital Technology International's FaceSpan, Main Event Software's Scripter, and Late Night Software Ltd.'s Script Debugger. Script Editor 1.6 has also been made available for Mac OS 9.1.

Script Editor is particularly useful for creating the first versions of scripts using the Finder in OS 9. You can record most tasks involving the Finder (such as an action involving a file, folder, or disk), and then make any manual changes later in Script Editor. Chapter 1, describes the recording of scripts.

The rest of this chapter is devoted to explaining the principal commands and controls of this program. I will also describe some basic scripting mechanics such as file-saving options and describe how to view dictionaries. The chapter concludes with an example applet that turns around and controls its creator.

Figure 2-1 shows what the Script Editor and its Results window (which displays the return values for its executed code) look like on the OS X desktop. The Script Editor includes controls and menus to:

Figure 2-1. Script Editor on OS X
figs/ascr_0201.gif
  • Compile, save, and run AppleScripts

  • Record Apple events from recordable applications

  • Debug scripts with the Event Log and Result window

  • View other application's dictionaries (see the section "Dictionaries")

    Team LiB   Previous Section   Next Section