Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 10 - Scripting Components / Scripting Components Reference
Required Scripting Component Routines / Saving and Loading Script Data


OSALoad

You can use the OSALoad function to load script data.

FUNCTION OSALoad(scriptingComponent: ComponentInstance; 
                 scriptData: AEDesc;
                 modeFlags: LongInt;
                 VAR resultingScriptID: OSAID): OSAError;
scriptingComponent

A component instance created by a prior call to the Component Manager function OpenDefaultComponent or OpenComponent (see page 10-4).
scriptData
The descriptor record containing the script data to be loaded.
modeFlags
Information used by individual scripting components. To avoid setting any mode flags, specify kOSAModeNull. To indicate that only the minimum script data required to run the script should be loaded, pass kOSAModePreventGetSource in this parameter.
resultingScriptID
The returned script ID for the compiled script.
DESCRIPTION
The OSALoad function loads script data and returns a script ID. The generic scripting component uses the descriptor record in the scriptData parameter to determine which scripting component should load the script. If the descriptor record is of type typeOSAGenericStorage, the generic scripting component uses the trailer at the end of the script data to identify the scripting component. If the descriptor record's type is the subtype value for another scripting component, the generic scripting component uses the descriptor type to identify the scripting component.

If you want the script ID returned by OSALoad to identify only the minimum script data required to run the script and you are sure that you won't need to display the source data to the user, specify the kOSAModePreventGetSource flag in the modeFlags parameter.

Scripting components other than the generic scripting component can load script data only if it has been saved in a descriptor record whose descriptor type matches the scripting component's subtype.

Script data may change after it has been loaded--for example, if your application allows the user to edit a script's source data. To test whether script data has been modified, pass its script ID to OSAGetScriptInfo. If it has changed, you can call OSAStore again to obtain a handle to the modified script data and save it.

RESULT CODES
noErr0No error
errOSACorruptData-1702Corrupt data
errOSASystemError-1750General scripting system error
errOSABadStorageType-1752Script data not for this scripting component
errOSADataFormatObsolete-1758Data format is obsolete
errOSADataFormatTooNew-1759Data format is too new
badComponentInstance$80008001Invalid component instance
SEE ALSO
For more information about the way scripting components interpret script data, see "Saving Script Data" on page 10-12.

For examples of the use of OSALoad, see Listing 10-4 on page 10-16 and Listing 10-6 on page 10-19.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996