10.2. More on Working with the Finder
I noted at the start of this chapter that the Finder is a good starting point to learn how to work with applications in AppleScript. You'll want to use Finder to delete and rename files and to do other things that are not handled directly by AppleScript's built-in file commands.
10.2.1. Looking at the Finder's Dictionary in Greater Detail
Applications that you communicate with from AppleScript define their own classes and commands. The best way to learn how to use these is by looking at other AppleScript examples (see Appendix C, "Resources") and by examining the application's dictionary. Unfortunately, the dictionary is sometimes inaccurate or incomplete and doesn't tell you how the classes and commands work together. Nevertheless, it is sometimes the only information you have available, so it's well worth your time to become proficient at navigating these dictionaries.
You saw a portion of the Finder's dictionary in Figure 10-2. It listed the properties of the Finder window class. In the following Try It Out, you back up a bit and take a closer look the Finder's dictionary.
10.2.1.1. Try It Out: Examining the Finder's Dictionary
In this example, you open the Finder's dictionary, see how it's structured, and learn about the Standard Suite and the Finder's classes, including containers, disks, folders, and files:
In Script Editor, choose FileOpen Dictionary. Locate the Finder application in the window that is displayed (see Figure 10-5
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.