Multiple-Word Terms

Many terms, especially commands in scripting additions, consist of multiple words . An example frequently used in this book is display dialog. You might think that such a term would present extra challenges for resolution, but in actual fact just the opposite appears to be the case; multiple-word terms are a good thing:

You can't make one

Terms that you create in a script can't contain spaces unless surrounded by pipes—and pipes mean that no dictionary will be consulted. Therefore the probability of your creating a term in a script that clashes with a dictionary-based multiple-word term is zero.

Clash is improbable

The more words a term consists of, the more likely it is that this term is unique among all dictionaries. This is especially important with scripting additions, whose terms are globally visible; for this reason, well-behaved scripting additions tend to use multiple-word commands.

There is no clash with single-word terms

This is the really surprising part. Consider, for example, the scripting addition command set the clipboard to. Even though set...to is a command, and the is usually ignored, and clipboard could be a variable name (and is in fact a property defined by AppleScript), no confusion arises:

local clipboard, tester
set clipboard to "Mannie" -- sets the variable clipboard
set the tester to "Moe" -- sets the variable tester (ignoring "the")
set the clipboard to "Jack" --sets the system scrap

Though I don't know the details, a natural explanation ...

Get AppleScript: The Definitive Guide, 2nd Edition 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.