Important: The information in this document is obsolete and should not be used for new development.
OSAGetSource
You can use theOSAGetSource
function to decompile the script data identified by a script ID and obtain the equivalent source data.
FUNCTION OSAGetSource(scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; VAR resultingSourceData: AEDesc): OSAError;
scriptingComponent
- A component instance created by a prior call to the Component Manager function
OpenDefaultComponent
orOpenComponent
(see page 10-4).scriptID
- The script ID for the script data to decompile. If you pass
kOSANullScript
in this parameter,OSAGetSource
returns a null source description (such as an empty text string).desiredType
- The desired descriptor type of the resulting descriptor record, or
typeBest
if any type will do.resultingSourceData
- The resulting descriptor record.
DESCRIPTION
TheOSAGetSource
function decompiles the script data identified by the specified script ID and returns a descriptor record containing the equivalent source data. The source data returned need not be exactly the same as the source data originally passed toOSACompile
--for example, white space and formatting might be different--but it should be a reasonable equivalent suitable for user viewing and editing.The difference between
OSACoerceToDesc
andOSAGetSource
is thatOSAGetSource
creates source data that can be displayed to a user or compiled and executed to generate an appropriate value, whereasOSACoerceToDesc
actually returns the value. For example, if you callOSAGetSource
and specify a string value, it returns the text surrounded by quotation marks (so that it can be properly compiled). If you callOSACoerceToDesc
and specify a string value, it simply returns the text.The main difference between
OSADisplay
andOSAGetSource
is thatOSAGetSource
can coerce any form of script data using a variety of descriptor types, whereasOSADisplay
can coerce only script values and always produces a descriptor record of a text descriptor type.RESULT CODES
SEE ALSO
For an example of the use ofOSAGetSource
, see Listing 10-5 on page 10-18.