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:
The AppleScript code starts life as text.
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.
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 ...
Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.