Lesson 10. Conditionals

The Simple if Test

The Two-Value if Test

The Multi-Value if Test

What’s Next?

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. ...

Get Apple Pro Training Series: AppleScript 1-2-3 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.