Scripting Additions Guide

CHAPTER 3
Writing Scripting Additions
Types of Scripting Additions 87
In Pascal,
FUNCTION MyAEHandlerFunction
(theEvent, theReply: AppleEvent;
theRefCon: Longint): OSErr;
The scripting addition handler is an extension to the AppleScript language. It
needs an 'aete' resource that describes the human-language terms defined
by the scripting addition for use in scripts, such as the names of commands,
objects, and properties. The high word of the resource ID for the 'aete' is a
script code that indicates the script system (that is, writing system) for which
the 'aete' is written, and the low word is a language code that indicates the
human language for which the 'aete' is written. For example, the resource ID
of the 'aete' resource of the sample scripting addition shown in Listing 3-3
(beginning on page 94) is 0; thus both the high word and low word are also 0,
indicating that the resource is intended for use with the Roman script system
and English terminology.
Apple Event Coercions Scripting Addition 3
The 'osax' resource for an Apple event coercion scripting addition follows
the following convention:
The letters CSDS or CSPT at the beginning of the resource name indicate that
the scripting addition provides an Apple event coercion. CSDS indicates an
Apple event coercion that uses the “from descriptor” interface. CSPT indicates
an Apple event coercion that uses the “coerce from pointer” interface. The next
eight characters of the resource name represent the “from” and “to” types.
The 'osax' code resource for scripting addition coercions is in the form
of Apple event coercion handler. The entry point for the code resource
must follow the Apple event coercion function interface for the particular
coercion form.
Resource type 'osax'
Resource ID An identifier (for example, 3069)
Resource name 'CSDSfromtoto' or 'CSPTfromtoto'