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
| 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 of OSADisplay, see page 10-35.