Important: The information in this document is obsolete and should not be used for new development.
OSALoad
You can use theOSALoad
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 functionOpenDefaultComponent
orOpenComponent
(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, passkOSAModePreventGetSource
in this parameter.resultingScriptID
- The returned script ID for the compiled script.
DESCRIPTION
TheOSALoad
function loads script data and returns a script ID. The generic scripting component uses the descriptor record in thescriptData
parameter to determine which scripting component should load the script. If the descriptor record is of typetypeOSAGenericStorage
, 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 thekOSAModePreventGetSource
flag in themodeFlags
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 callOSAStore
again to obtain a handle to the modified script data and save it.RESULT CODES
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.