DekGenius.com
[ Team LiB ] Previous Section Next Section

Chapter 2. Places to Use AppleScript

In the previous chapter you learned about the kinds of thing you can do with AppleScript. But where can you do these things? You're going to write and run some AppleScript code; where are you going to write it, and where are you going to run it? This chapter answers these questions, by surveying the many areas of your computer where AppleScript is available to you.

We've seen that the main reason for using AppleScript is in order to drive a scriptable application. AppleScript does this by sending messages, which are actually Apple events, to the scriptable application. So the scriptable application is the receiver (or target) of these messages; AppleScript, and by extension the host environment where AppleScript code is being run, is the sender . So this chapter is about the various kinds of environment you might use as a sender.

As you will see in more detail in Chapter 4, there are three stages in the life of an AppleScript program:

  1. The AppleScript code starts life as text.

  2. Then that text is compiled into a different form, one that humans can't read but that AppleScript can execute. The compiled code can optionally be saved at this point, as a compiled script file.

  3. Finally, the compiled code is executed, or run.

We are really concerned in this chapter only with the last stage—the kinds of place where compiled AppleScript code can be executed—though it happens that many such places can also compile AppleScript code, transforming it from raw text into executable form.

(In general I have had to make up some descriptive terms in order to taxonomize the kinds of sender described in this chapter, but I define those terms immediately, and I don't think this makes the taxonomy any less helpful. The example scripts in this chapter are for the most part deliberately simple and somewhat contrived; they are not intended to provide any serious illustration of the actual uses to which AppleScript might be put. That, after all, was the task of the previous chapter.)

    [ Team LiB ] Previous Section Next Section