Important: The information in this document is obsolete and should not be used for new development.
OSACoerceToDesc
You can use theOSACoerceToDesc
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
orOpenComponent
(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
TheOSACoerceToDesc
function coerces the script value identified byscriptValueID
to a descriptor record of the type specified by thedesiredType
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 theresult
parameter to be the same as the descriptor type returned by a scripting component, useOSACoerceToDesc
and specifytypeWildCard
as 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.