You’ve learned a lot about the nuts and bolts of AppleScript, including how to store and manipulate data. But you haven’t yet learned much about how to make your scripts smart. You’ll take the first step toward writing intelligent scripts in this chapter.
What is the most important criterion of intelligence? We think it’s the ability to make decisions and to act on them. In AppleScript, the key to making decisions is the
if statement and its variants. With an
if statement, your script takes a quick look at the world around it, notices the current state of some condition it’s interested in, and responds appropriately based on what it sees. ...