Chapter 19. Dictionaries

A dictionary is a scriptable application’s way of letting the world know how it extends AppleScript’s vocabulary. This extended vocabulary is called the application’s terminology . AppleScript itself defines few commands, and has few abilities of its own; its value emerges when it is used for communicating, by means of Apple events, with scriptable applications. A scriptable application provides powers that AppleScript lacks, along with terminology that permits the programmer to harness those powers. For example, AppleScript can’t make a new folder on your hard drive, but the Finder can; and the Finder supplements AppleScript’s vocabulary with terms such as make and folder so that you can use AppleScript to command it (the Finder) to do so. This supplementary terminology is made available through the Finder’s dictionary.

A dictionary has two intended audiences:

The AppleScript programmer

The AppleScript programmer studies a human-readable display of an application’s dictionary to learn what English-like terms beyond those built into the AppleScript language itself may be used when targeting that application.

AppleScript

AppleScript uses an application’s dictionary at compile time to look up the terms that the programmer uses. In this way, AppleScript confirms that the terms really exist; since they don’t exist within AppleScript itself, AppleScript cannot know without a dictionary that the programmer isn’t just talking nonsense. AppleScript also uses the dictionary ...

Get AppleScript: The Definitive Guide 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.