|
AppleScript’s real power and purpose lies in communicating with scriptable applications, which provide powers that AppleScript lacks. In order that you, the AppleScript programmer, may harness its powers, a scriptable application extends the vocabulary of the 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 how it extends AppleScript’s vocabulary. 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. Under certain circumstance, a compiled script may open but display some of its raw Apple events (as four-letter codes surrounded by chevrons) instead of the English-like terminology. And, as a power user feature, Script Debugger lets you deliberately display raw Apple events instead of English-like terminology. 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 it might result in a script that compiles and runs, but behaves mysteriously. Script Debugger helps you track down terminology clash by letting you view raw Apple event codes in your script, in the Apple Event Log window, and in dictionaries, and by letting you search for terminology in all visible dictionaries at once.
|
|||||||||||||||||