Important: The information in this document is obsolete and should not be used for new development.
OSAGetScriptingComponent
You can use theOSAGetScriptingComponent
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
orOpenComponent
(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 withOSAGetScriptingComponent
.The
OSAGetScriptingComponent
function returns, in thescriptingInstance
parameter, an instance of the scripting component identified by thescriptingSubType
parameter. Each instance of the generic scripting component keeps track of a single instance of each component subtype, soOSAGetScriptingComponent
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 toOSAGetScriptingComponent
. Finally, you can pass that instance toOSAScriptingComponentName
to obtain the default scripting component's name so you can display it to the user.Similarly, you can pass
kAppleScriptSubtype
in thescriptingSubType
parameter 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 theOSAGetDefaultScriptingComponent
andOSAScriptingComponentName
functions, see page 10-85 and page 10-46, respectively.