Important: The information in this document is obsolete and should not be used for new development.
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 theOSAStartRecording
andOSAStopRecording
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 callsOSAStartRecording
, 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 callsOSAStopRecording
, 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 IDtypeWildCard
, handles those recordable events by recording them in the compiled script specified in the call toOSAStartRecording
.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.
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.