Google

PLT MzLib: Libraries Manual


sendevent.ss: AppleEvents

26.1  AppleEvents

(send-event receiver-string event-class-string event-id-string [direct-argument-v argument-list])      PROCEDURE

Sends an AppleEvent or raises exn:misc:unsupported. Currently AppleEvents are supported only within MrEd under Mac OS Classic and Mac OS X.

The receiver-string, event-class-string, and event-id-string arguments specify the signature of the receiving application, the class of the AppleEvent, and the ID of the AppleEvent. Each of these must be a four-character string, otherwise the exn:application:type exception is raised.

The direct-argument-v value is converted (see below) and passed as the main argument of the event; if direct-argument-v is void, no main argument is sent in the event. The argument-list argument is a list of two-element lists containing a typestring and value; each typestring is used ad the keyword name of an AppleEvent argument for the associated converted value. Each typestring must be a four-character string, otherwise the exn:application:mismatch exception is raised. The default values for direct-argument and arguments are void and null, respectively.

The following types of MzScheme values can be converted to AppleEvent values passed to the receiver:

#t or #f Boolean
small integer Long Integer
inexact real number Double
string Characters
list of convertible values List of converted values
#(file pathname) Alias (file exists) or FSSpec (does not exist)
#(record (typestring v) ···) Record of keyword-tagged values

If other types of values are passed to send-event for conversion, the exn:misc:unsupported exception is raised.

The send-event procedure does not return until the receiver of the AppleEvent replies. The result of send-event is the reverse-converted reply value (see below), or the exn:misc exception is raised if there is an error. If there is no error or return value, send-event returns void.

The following types of AppleEvent values can be reverse-converted into a MzScheme value returned by send-event:

Boolean #t or #f
Signed Integer integer
Float, Double, or Extended inexact real number
Characters string
list of reverse-convertible values List of reverse-converted values
Alias or FSSpec #(file pathname)
Record of keyword-tagged values #(record (typestring v) ···)

If the AppleEvent reply contains a value that cannot be reverse-converted, the exn:misc exception is raised.