AppleScript’s real power and purpose lies in communicating with scriptable applications and scripting additions. These provide powers that AppleScript itself lacks. In order that you, the AppleScript programmer, may harness the powers of a scriptable application or scripting addition, it extends the vocabulary of the basic AppleScript language. This extended vocabulary is called a scriptable application’s terminology. A dictionary is the means by which a scriptable application or scripting addition lets you (and AppleScript) know about this terminology.
The dictionary translates between two forms of terminology — the English-like terms, which you use in your script, and the raw Apple event codes, which AppleScript uses to construct Apple events when communicating with a scriptable application.
When you write a script using English-like terms, the dictionary is used to translate them into raw Apple events to be sent to scriptable applications.
In a compiled script file, the raw Apple events are encoded directly into the bytecode. In order to open the compiled script file and decompile it, the dictionary is used to translate the raw Apple events back into English-like terms. This is why AppleScript may have trouble opening a script in the absence of a required dictionary.
At any given moment in a script there are several sets of terminology visible at once — variable names used in the script, terms from the dictionary of the targeted application, terms from scripting additions, terms from AppleScript’s own dictionary. If the script chooses its terms unwisely, or if the visible dictionaries use the same terminology in different ways, terminology clash can occur. Terminology clash can result in a script that won’t compile or run, or a script that behaves mysteriously.
Script Debugger helps you track down terminology clash by letting you deliberately view raw Apple event codes in your script, in the event log, in outliners, and in dictionaries.
Also, you can search for terminology in all visible dictionaries at once; this can help track down terminology clash as well.
Under certain circumstances, a compiled script may open but display some of its raw Apple events instead of the English-like terminology, even when you have not elected to see the raw codes. This can happen because a scripting addition couldn’t be found, or because of some problem with an application’s dictionary; one way or another, the underlying dictionary information needed to convert bytecode back into English terminology is missing.
If you use an application with an
'aete'
dictionary that allows the dictionary to be extended through plug-ins (such as QuarkXPress or InDesign), read the discussion of Script Debugger’s dictionary caching mechanism.