Important: The information in this document is obsolete and should not be used for new development.
OSAGetSource
You can use theOSAGetSourcefunction 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
OpenDefaultComponentorOpenComponent(see page 10-4).
scriptID- The script ID for the script data to decompile. If you pass
kOSANullScriptin this parameter,OSAGetSourcereturns a null source description (such as an empty text string).
desiredType- The desired descriptor type of the resulting descriptor record, or
typeBestif any type will do.
resultingSourceData- The resulting descriptor record.
DESCRIPTION
TheOSAGetSourcefunction 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
OSACoerceToDescandOSAGetSourceis thatOSAGetSourcecreates source data that can be displayed to a user or compiled and executed to generate an appropriate value, whereasOSACoerceToDescactually returns the value. For example, if you callOSAGetSourceand specify a string value, it returns the text surrounded by quotation marks (so that it can be properly compiled). If you callOSACoerceToDescand specify a string value, it simply returns the text.The main difference between
OSADisplayandOSAGetSourceis thatOSAGetSourcecan coerce any form of script data using a variety of descriptor types, whereasOSADisplaycan 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.
 
  
  
 