Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 10 - Scripting Components / Using Scripting Component Routines


Recording Scripts

If you want your application to record Apple events in the form of a compiled script, or if you are writing a script-editing application like Script Editor, you can use the OSAStartRecording and OSAStopRecording functions to start and stop recording into a specified script ID on a single computer. Both functions take a component instance and a script ID for a compiled script. When your application calls OSAStartRecording, the scripting component identified by the component instance sends a Start Recording event to your application and installs a Receive Recordable Event handler in your application's Apple event dispatch table. When your application calls OSAStopRecording, the scripting component removes the handler.

An application acting as a recording process in this manner should not provide a handler for the Start Recording event. Instead, the Apple Event Manager receives the event and responds by sending a Recording On event to all running processes on the local computer. Thereafter, the Apple Event Manager sends copies of subsequent recordable events to the recording process, whose previously installed Receive Recordable Event handler, much like a handler for event class typeWildCard and event ID typeWildCard, handles those recordable events by recording them in the compiled script specified in the call to OSAStartRecording.

Whenever the Receive Recordable Event handler receives a recordable event, the scripting component sends your application a Recorded Text event. The Recorded Text event contains the decompiled source data for the recorded event in the form of styled text.
Recorded Text--append styled text to script editor window
Event classkOSASuite
Event IDkOSARecordedText
Required parameter 
 Keyword:keyDirectObject
 Descriptor type:typeStyledText or any other text descriptor type
 Data:Decompiled source data for recorded event
DescriptionSent by a scripting component to a recording process for each event recorded after a call to OSAStartRecording

If your want your application to display the source data for recorded events as they are recorded, you must provide a handler for the Recorded Text event.

For more information about the Receive Recordable Event handler and Apple event recording, see "How Apple Event Recording Works," which begins on page 9-35.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996