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
Optional Scripting Component Routines / Coercing Script Values


OSACoerceToDesc

You can use the OSACoerceToDesc function to coerce a script value to a descriptor record of a desired descriptor type.

FUNCTION OSACoerceToDesc(scriptingComponent: ComponentInstance;
                         scriptValueID: OSAID; 
                         desiredType: DescType;
                         modeFlags: LongInt;
                         VAR result: AEDesc): OSAError;
scriptingComponent
A component instance created by a prior call to the Component Manager function OpenDefaultComponent or OpenComponent (see page 10-4).
scriptValueID
The script ID for the script value to coerce.
desiredType
The desired descriptor type of the resulting descriptor record.
modeFlags
Information used by individual scripting components. To avoid setting mode flag values, specify kOSAModeNull.
result
The resulting descriptor record.
DESCRIPTION
The OSACoerceToDesc function coerces the script value identified by scriptValueID to a descriptor record of the type specified by the desiredType parameter, if possible. Valid types include all the standard descriptor types defined in the Apple Event Registry: Standard Suites, plus any special types supported by the scripting component.

SPECIAL CONSIDERATIONS
If you want the descriptor type of the descriptor record returned in the result parameter to be the same as the descriptor type returned by a scripting component, use OSACoerceToDesc and specify typeWildCard as the desired type. If you want to get a script value in a form that you can display for humans to read, use OSADisplay.

RESULT CODES
noErr0No error
errOSASystemError-1750General scripting system error
errOSAInvalidID-1751Invalid script ID
badComponentInstance$80008001Invalid component instance
SEE ALSO
For a description of OSADisplay, see page 10-35.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996