O'Reilly logo

AppleScript® Programming for the Absolute Beginner by Jerry Lee Ford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fundamentals of Conditional Logic

By implementing conditional programming logic, you can develop AppleScripts that are capable of adapting their execution based on different conditions. To put it another way, using conditional logic, your AppleScripts can be set up to execute different sets of programming statements based on the value of the data they are presented with. This data may be collected from the operating system. Data may also come from files stored on the computer or it may be provided directly by the user.

Regardless of where the data originates, you can set up your AppleScript to analyze it using the if statement. To get a feel for how to work with the if statement, take a look at the following code block.

if the temperature is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required