Important: The information in this document is obsolete and should not be used for new development.
OSACoerceToDesc
You can use theOSACoerceToDescfunction 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
OpenDefaultComponentorOpenComponent(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
TheOSACoerceToDescfunction coerces the script value identified byscriptValueIDto a descriptor record of the type specified by thedesiredTypeparameter, 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 theresultparameter to be the same as the descriptor type returned by a scripting component, useOSACoerceToDescand specifytypeWildCardas the desired type. If you want to get a script value in a form that you can display for humans to read, useOSADisplay.RESULT CODES
noErr 0 No error errOSASystemError -1750 General scripting system error errOSAInvalidID -1751 Invalid script ID badComponentInstance $80008001 Invalid component instance SEE ALSO
For a description ofOSADisplay, see page 10-35.