Apple events

Apple events

Apple events are the canonical message-based interprocess communication mechanism in Mac OS, first appearing in System 7 and supported by every version since then, including Mac OS X. Apple events describe "high-level" events such as "open document" or "print file", whereas earlier OS's had supported much more basic events only, namely "click" and "keypress". Apple events form the basis of the Mac OS scripting system, AppleScript.

The starting point is a dynamically-typed, extensible descriptor format called an AEDesc, which is just an OSType code specifying the data type, together with a block of type-dependent data. For instance, the OSType code inte indicated that the data was a four-byte signed integer in big-endian format.

Besides predefined type codes for various common simple types, there are two predefined structured descriptor types: an AERecord, which has data type reco (record), and AEList with type list (list or array). The internal structure of these contain recursively-nested AEDescs, while the AERecord also associated each element with a unique record field ID, which is an OSType. The Apple Event Manager provides API calls to construct these structures, as well as extract their contents and query the type of contents they hold.

The Apple Event Manager also supports "coercions", which converts AEDescs from one data type to another. In addition to standard coercions, for instance between integer and real types, applications can install their own coercion handler callbacks, which could handle conversions to and from custom data types.

An Apple event proper is an AERecord with fields that depended on the purpose of the event. In addition, it has "attributes" (which are distinct from record fields, which are now called the "parameters" of the event) from a set predefined by the Apple Event Manager, specifying such things as the event type and class codes which indicates what the event is supposed to do (both OSTypes), the target address to which the event is to be sent (which could be a process on the local or a remote machine), and various other options for handling it. Remote machines initially had to be connected via AppleTalk, but Mac OS 9 added the option for connections via TCP/IP.

After sending an Apple event to its target process, the sending process could elect to receive a reply. This is also an Apple event, which could contain various bits of information returned from the target about the processing of the request event, including an error code indicating success/failure, or any other appropriate information.

Apple events are the foundation of the AppleEvent Object Model, which in turn is the foundation of AppleScript. Many other programming languages can send and receive Apple events, including C, C++, Objective-C, Perl, UserTalk, Ruby and Python.

External links

* [http://developer.apple.com/documentation/AppleScript/Conceptual/AppleEvents/intro_aepg/chapter_1_section_1.html Apple Events Programming Guide]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Apple Developer Tools — Developer(s) Apple Inc. Stable release 3.1 (1096) / April 2008 Operating system Mac OS X Type IDE …   Wikipedia

  • Apple Day — is an annual celebration, held on October 21 each year, of apples and orchards.Apple Day was initiated by Common Ground in 1990 and has been celebrated in each subsequent year by people organizing hundreds of local events. Common Ground describe… …   Wikipedia

  • Apple v. Does — is a lawsuit filed by Apple Computer in December 2004 against unnamed individuals. The suit, filed in Santa Clara County, California, alleges that the defendants leaked information about new Apple products to several online news sites, including… …   Wikipedia

  • Apple bobbing — Apple bobbing, also known as bobbing for apples, is a game often played in connection with Halloween. The game is played by filling a tub or a large basin with water and putting apples in the water. Because apples are less dense than water, they… …   Wikipedia

  • Apple Blossom Festival — can refer to several different events:* Annapolis Valley Apple Blossom Festival, in Nova Scotia s Annapolis Valley* Shenandoah Apple Blossom Festival, in Virginia s Shenandoah Valley* Washington State Apple Blossom Festival, in Wenatchee,… …   Wikipedia

  • Apple Inc. advertising — In the past two decades, Apple Inc. has become appreciated for the artistic and free thinking messages of its advertisements, which reflect a business plan of marketing their products to creative individuals. Their most significant ad campaigns… …   Wikipedia

  • Apple Inc. — This article is about the technology company. For other companies named Apple , see Apple (disambiguation). Apple Inc …   Wikipedia

  • Apple Newton — The Apple Newton, or simply Newton, is the iPhone s predecessor and was an early line of personal digital assistants developed and marketed by Apple Computer (now Apple Inc.) from 1993 to 1998. Some electronic engineering and the manufacture of… …   Wikipedia

  • apple of discord — noun (classical mythology) a golden apple thrown into a banquet of the gods by Eris (goddess of discord who had not been invited); the apple had for the fairest written on it and Hera and Athena and Aphrodite all claimed it; when Paris (prince of …   Useful english dictionary

  • Apple iPhone 2G — iPhone iPhone der 1. Generation im MP3 Player Modus Hersteller Apple Inc. Funkverbindungen …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”