OSAMakeContext
You can use the OSAMakeContext function to get a script ID for a new script context.
FUNCTION OSAMakeContext(scriptingComponent: ComponentInstance;
contextName: AEDesc;
parentContext: OSAID;
VAR resultingContextID: OSAID): OSAError;
scriptingComponent
- A component instance created by a prior call to the Component Manager function
OpenDefaultComponent or OpenComponent (see page 10-4).
contextName
- Name of new context. Some scripting components may use context names for semantic purposes. If the value of this parameter is
typeNull, OSAMakeContext creates an unnamed context.
parentContext
- Existing context from which new context inherits bindings. If the value of this parameter is
kOSANullScript, the new context does not inherit bindings from any other context.
resultingContextID
- A script ID for the resulting script context.
DESCRIPTION
The OSAMakeContext function creates a new script context that you may pass to OSAExecute or OSAExecuteEvent. The new script context inherits the bindings of the script context specified in the parentContext parameter.
SPECIAL CONSIDERATIONS
If you call OSAMakeContext using an instance of the generic scripting component, the generic scripting component uses the default scripting component to create the new script context.
RESULT CODES
| noErr | 0 | No error |
| errOSACantCoerce | -1700 | Invalid context name |
| errOSASystemError | -1750 | General scripting system error |
| errOSAInvalidID | -1751 | Invalid script ID |
| badComponentInstance | $80008001 | Invalid component instance D |
SEE ALSO
To compile existing source data into a script context, use OSACompile as described on page 10-47.