Important: The information in this document is obsolete and should not be used for new development.
OSAGetScriptInfo
You can useOSAGetScriptInfo
to obtain information about script data according to the value you pass in theselector
parameter.
FUNCTION OSAGetScriptInfo(scriptingComponent: ComponentInstance; scriptID: OSAID; selector: OSType; VAR result: LongInt): 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 about which to obtain information.
selector
- A value that determines what kind of information
OSAGetScriptInfo
returns. The value can be one of these constants:CONST kOSAScriptIsModified = 'modi'; kOSAScriptIsTypeCompiledScript = 'cscr'; kOSAScriptIsTypeScriptValue = 'valu'; kOSAScriptIsTypeScriptContext = 'cntx'; kOSAScriptBestType = 'best'; kOSACanGetSource = 'gsrc';
- The AppleScript component provides limited support for the constant kOSAScriptIsModified (see page 10-44). In addition to the standard constants, the AppleScript component also supports this constant:
CONST kASHasOpenHandler = 'hsod';
result
- The requested information, which you can coerce to the appropriate descriptor type for the value specified in the
selector
parameter.DESCRIPTION
TheOSAGetScriptInfo
function returns various results according to the value you pass in theselector
parameter.
Value of selector
parameterInformation returned in the result
parameterkOSAScriptIsModified
Long integer that indicates the number of times the script data has been modified since it was passed to OSALoad
.kOSAScriptIsTypeCompiledScript Boolean value that indicates whether or not the script data is a compiled script. kOSAScriptIsTypeScriptValue Boolean value that indicates whether or not the script data is a script value. kOSAScriptIsTypeScriptContext Boolean value that indicates whether or not the script data is a script context. kOSAScriptBestType A descriptor type that you can pass to OSACoerceToDesc
.kOSACanGetSource Boolean value that indicates whether the script data can be successfully passed to OSAGetSource
.The AppleScript component also provides this constant for use in the
selector
parameter.SPECIAL CONSIDERATIONS
Although you can specifykOSAScriptIsModified
when you are using the AppleScript component without generating an error, the current version of AppleScript interprets this request conservatively. The AppleScript component stores script data in a network of interlocking structures, and running a script can cause any of these structures to be modified. If you pass a script ID is toOSAGetScriptInfo
withkOSAScriptIsModified
as the value of theselector
parameter, the AppleScript component returns 1 if there is any possibility that the script data or related structures may have been modified, and 0 if there is no possibility that they have been modified.RESULT CODES