Important: The information in this document is obsolete and should not be used for new development.
OSADisplay
You can use theOSADisplayfunction to convert a script value to text. Your application can then use its own routines to display this text to the user.
FUNCTION OSADisplay(scriptingComponent: ComponentInstance; scriptValueID: OSAID; desiredType: DescType; modeFlags: LongInt; VAR resultingText: 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 text descriptor type, such as
typeChar, for the resulting descriptor record.modeFlags- Information used by individual scripting components. To avoid setting any mode flags, specify
kOSAModeNull. To make the resulting text readable by humans only, so that it can't be recompiled, specifykOSAModeDisplayForHumans.resultingText- The resulting descriptor record.
DESCRIPTION
TheOSADisplayfunction coerces the script value identified byscriptValueIDto a descriptor record of the text type specified by thedesiredTypeparameter, if possible. Valid types include all the standard text descriptor types defined in the Apple Event Registry: Standard Suites, plus any special types supported by the scripting component.Unlike
OSAGetSource,OSADisplaycan coerce only script values and always produces a descriptor record of a text descriptor type. In addition, if you specify the mode flagkOSAModeDisplayForHumans, the resulting text cannot be recompiled.SPECIAL CONSIDERATIONS
If you want to get a script value in a form that you can display for humans to read, useOSADisplay. If you want the descriptor type of the descriptor record returned in theresultingTextparameter to be the same as the descriptor type returned by a scripting component, useOSACoerceToDescand specifytypeWildCardas the desired type.RESULT CODES
noErr 0 No error errOSACantCoerce -1700 Desired type not supported by scripting component errOSASystemError -1750 General scripting system error errOSAInvalidID -1751 Invalid script ID badComponentInstance $80008001 Invalid component instance SEE ALSO
For descriptions of theOSAGetSourceandOSACoerceToDescfunctions, see page 10-51 and page 10-54, respectively.For an example of the use of
OSADisplay, see Listing 10-2 on page 10-9.