Important: The information in this document is obsolete and should not be used for new development.
OSAGetScriptingComponent
You can use theOSAGetScriptingComponentfunction 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
OpenDefaultComponentorOpenComponent(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
scriptingSubTypeparameter.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 withOSAGetScriptingComponent.The
OSAGetScriptingComponentfunction returns, in thescriptingInstanceparameter, an instance of the scripting component identified by thescriptingSubTypeparameter. Each instance of the generic scripting component keeps track of a single instance of each component subtype, soOSAGetScriptingComponentalways 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
OSAGetDefaultComponentto 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 toOSAGetScriptingComponent. Finally, you can pass that instance toOSAScriptingComponentNameto obtain the default scripting component's name so you can display it to the user.Similarly, you can pass
kAppleScriptSubtypein thescriptingSubTypeparameter to obtain an instance of the AppleScript component. This is necessary, for example, to call AppleScript-specific routines such asASGetSourceStyles.RESULT CODES
noErr 0 No error errOSACantOpenComponent -1762 Can't connect to scripting component badComponentInstance $80008001 Invalid component instance SEEALSO
For descriptions of theOSAGetDefaultScriptingComponentandOSAScriptingComponentNamefunctions, see page 10-85 and page 10-46, respectively.