Important: The information in this document is obsolete and should not be used for new development.
Components of MacApp's Scripting Support
MacApp provides a number of components that work together to implement scripting support for your application. The sections that follow provide additional detail on these components.
In addition to these components, MacApp processes many Apple events automatically in the
- 'aedt' resource. MacApp also provides an Apple event dispatch table resource that maps a received Apple event (by class ID and descriptor type) to a MacApp command number. You can add
'aedt'
resources to establish mappings for custom events.- 'aete' resource. MacApp provides an Apple event terminology extension resource that defines terminology for the four required Aßpple events, as well as for all of the events in the Core suite supported by MacApp. Your application can modify and extend this resource.
- MScriptableObject. The
MScriptableObject
class is a mixin (or multiple-inheritance) class that helps an object
- respond to Apple events
- get and set object properties
- describe itself in terms the OSL can understand
- return the objects it contains
- have an attached script that can respond to Apple events
The
TDocument
,TFile
,TWindow
, and other MacApp classes mix in this class, and you can add it to any class you define that doesn't already use it.
- MDefaultScriptableObject.
MDefaultScriptableObject
, a mixin subclass ofMScriptableObject
, helps an object serve as the destination for Apple events that don't specify a target object. MacApp'sTApplication
class uses this mixin class and serves as the default target for Apple events.- TAppleEvent. The
TAppleEvent
class reads and writes Apple event data and sends Apple events.- TSetPropertyEvent. The
TSetPropertyEvent
class, a subclass ofTAppleEvent
, sends an Apple event to change an object property for objects in a list of one or more objects.- TCommand. The
TCommand
class provides a method to create an Apple event to make the command action recordable.- TSetPropertyCommand. The
TSetPropertyCommand
class implements an undoable command that can automatically set object properties for your classes that override theGetObjectProperty
andSetObjectProperty
methods. (You may also have to override theGetSetPropertyInfo
method.)- TClientCommand, TServerCommand. The
TClientCommand
class and theTServerCommand
class provide services for sending an Apple event to an external process, either synchronously or asynchronously, and processing a reply (if one is requested).- TExecuteScriptCommand. The
TExecuteScriptCommand
class executes a script.- TFileBasedDocument. The
TFileBasedDocument
class contains support for saving an attached script in the resource fork of a document and reading the script when the document is opened.- TOSADispatcher. The
TOSADispatcher
class manages the resolution and dispatching of incoming and outgoing object model Apple events. During scripting initialization, the global static fieldTOSADispatcher
::fgDispatcher
is set to an instance ofTOSADispatcher
. ThefgDispatcher
object dispatches Apple events to specified objects, working with callbacks from the OSL to determine the target object.- TOSAScriptRep. The
TOSAScriptRep
class serves as a wrapper for an attached script. ThefScript
field (of typeCOSAScript
) refers to the actual script object. TheTOSAScriptRep
class keeps track of references to the script, reads and writes the script, and handles events for the script. You don't reference an instance of this class directly--you work instead through aCOSAScriptCntPtr
object.- COSAScript. The
COSAScript
class is a wrapper for a low-level OSA script. It provides methods that call on OSA routines to send an event to the script, execute the script, set the script, dispose of the script, and so on. ThefScriptID
field (of typeOSAID
) specifies the script the class operates on.- COSAScriptCntPtr. The
COSAScriptCntPtr
class is used as an accessor for aTOSAScriptRep
object. This class allows multiple objects to refer to the same script. ACOSAScriptCntPtr
object keeps a count of references to the script object and deletes the object if the count goes to 0. TheMScriptableObject
class has a field of this type to refer to an attached script.
TApplication
,TDocument
, andTWindow
classes, although your subclasses may need to provide some additional code.