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 / Using Component-Specific Routines


OSAGetScriptingComponent

You can use the OSAGetScriptingComponent function to get the instance of a scripting component for a specified subtype.

FUNCTION OSAGetScriptingComponent
               (genericScriptingComponent: ComponentInstance;
                scriptingSubType: ScriptingComponentSelector;
                VAR scriptingInstance: ComponentInstance)
                : OSAError;
genericScriptingComponent
A component instance for the generic scripting component, created by a prior call to the Component Manager function OpenDefaultComponent or OpenComponent (see page 10-4).
scriptingSubType
A subtype code for a scripting component.
scriptingInstance
The function returns, in this parameter, a component instance for the scripting component identified by the scriptingSubType parameter.
DESCRIPTION
You can't use the generic scripting component with component-specific routines. Instead, use an instance of the specific scripting component, which you can obtain with OSAGetScriptingComponent.

The OSAGetScriptingComponent function returns, in the scriptingInstance parameter, an instance of the scripting component identified by the scriptingSubType parameter. Each instance of the generic scripting component keeps track of a single instance of each component subtype, so OSAGetScriptingComponent always returns the same instance of a specified scripting component that the generic scripting component uses for standard scripting component routines.

For example, you can use OSAGetDefaultComponent to get the subtype code for the default scripting component (that is, the scripting component used by the generic scripting component for new scripts). You can then get an instance of the default scripting component by passing its subtype code to OSAGetScriptingComponent. Finally, you can pass that instance to OSAScriptingComponentName to obtain the default scripting component's name so you can display it to the user.

Similarly, you can pass kAppleScriptSubtype in the scriptingSubType parameter to obtain an instance of the AppleScript component. This is necessary, for example, to call AppleScript-specific routines such as ASGetSourceStyles.

RESULT CODES
noErr0No error
errOSACantOpenComponent-1762Can't connect to scripting component
badComponentInstance$80008001Invalid component instance
SEEALSO
For descriptions of the OSAGetDefaultScriptingComponent and OSAScriptingComponentName functions, see page 10-85 and page 10-46, respectively.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996