Chapter 31. Interapplication Communications
The Macintoshâs system-level mechanism for letting applications communicate with one another is Apple events .[154] An application that defines a repertoire of Apple events to which it is prepared to respond is described as scriptable . Another application can send to a scriptable application an Apple event from the scriptable applicationâs defined repertoire, to give it a command or to ask for information.
An Apple event is an ingeniously designed package of data, and can express a command or query of astonishing power and complexity. This means, however, that an Apple event is itself a particularly complex data structure. A convenient way to construct and send Apple events without having to deal with the details of their raw structure is through AppleScript , a programming language that encodes Apple events as English-like expressions. This, too, is a system-level mechanism; AppleScript code is interpreted and executed as Apple events by way of the systemâs Open Scripting Architecture, or OSA. (The term âAppleScriptâ properly refers to the language, but I use it also to refer to a scriptâa self-contained piece of executable code written in that languageâso as not to have to talk about an âAppleScript script.â)
REALbasic can construct and send raw Apple events. Also, it can incorporate and execute AppleScripts written and compiled in some other milieu, such as Appleâs own Script Editor. Through both these means, ...
Get REALBasic: TDG, 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.