Chapter 10. Working with Applications

One of the key uses of AppleScript is for automating tasks. These can be simple tasks such as renaming the files in a folder or more sophisticated tasks such as extracting images from the Internet and creating a slide show from them. In both cases, AppleScript can be used to automate the task. This is particularly valuable when the task requires that you type the same sequence of commands over and over again.

When you can communicate with an application using a scripting language like AppleScript, the application is called scriptable. Unfortunately, not all applications that run on the Mac are scriptable. Some applications are more scriptable than others, meaning that some applications (such as the Finder) provide a rich assortment of commands that enable you to automate just about anything you could if you were sitting at the keyboard and typing commands.

This chapter teaches you how to work with other applications. AppleScript's tell command provides the mechanism that enables you to talk to another application in order to ask it to do something for you. Because the Finder is an application found on all Mac systems and because it is very scriptable, the focus of this chapter is talking to the Finder. The principles that underlie working with the Finder can be applied to working with other applications as well.

Get Beginning AppleScript® 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.