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 / Scripting Components Reference


Generic Scripting Component Routines

To manipulate and execute scripts written in different scripting languages, your application can either open a connection with each corresponding scripting component individually or open a single connection with the generic scripting component. For information about how to connect with scripting components, see "Connecting to a Scripting Component," which begins on page 10-3.

If you open a connection with the generic scripting component, it in turn attempts to open connections dynamically with the appropriate scripting component for each script that it executes or manipulates. To provide this capability, the generic scripting component must be able to determine which scripting component created any script ID passed as a parameter to a standard scripting component routine. Because different scripting components may end up using the same script ID to refer to different scripts, the generic scripting component uses its own generic script IDs. The generic scripting component translates generic scripting IDs into the corresponding component-specific script IDs and vice versa when necessary.

A generic script ID is a script ID of type GenericID.

TYPE GenericID = OSAID;
You don't need to know in detail how the generic scripting component keeps track of script IDs. However, you should be aware that the script IDs to which your application refers when it uses the generic scripting component are not the same as the script IDs used by scripting components that actually manipulate and execute scripts.

If you are writing a script editor or recorder, you must pass the existing script ID to OSACompile or OSAStartRecording when you are recompiling or recording into an existing script. This ensures that the script is recompiled or recorded using the same scripting component that originally created the script. If instead you pass kOSANullScript to these routines, the new script is compiled or recorded using the default scripting component. Each instance of the generic scripting component has its own default scripting component. The section "Getting and Setting the Default Scripting Component," which follows, describes routines provided by the generic scripting component that allow you to get and set the default scripting component.

The generic scripting component supports the standard scripting component routines. However, most scripting components also support their own component-specific routines. You can't use the generic scripting component to call a component-specific routine. Instead, you must use an instance of the specific scripting component that supports the routine.

To facilitate the use of component-specific routines, the generic scripting component allows you to identify the scripting component that created stored script data, get an instance of a specified scripting component, and convert between generic script IDs and component-specific script IDs. The section "Using Component-Specific Routines," which begins on page 10-86, describes the generic scripting component routines that allow you to perform these tasks.

Some generic scripting component routines take or return a component subtype of type ScriptingComponentSelector.

TYPE ScriptingComponentSelector = OSType; 
You can use subtype codes of this type to identify specific scripting components.


Subtopics
Getting and Setting the Default Scripting Component
Using Component-Specific Routines

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996