Scripting Additions Guide

CHAPTER 2
Scripting Addition Commands
Command Definitions 35
PARAMETER
referenceToFile A reference of the form file nameString or alias nameString
(see “Notes”). The file must be a compiled script file or a script
application file. It cannot be a text file.
Class: Reference
RESULT
A script object.
EXAMPLES
The following example loads a compiled script called Numeric Operations and
stores the resulting script object in the variable NumericLib. The Tell
statement shows how to call a subroutine contained in the script object.
load script file "MacHD:Scripts:Numeric Operations"
set NumericLib to result
tell NumericLib
factorial(10)
end tell
NOTES
To specify the name (nameString) of a file, use a string of the form "Disk:Folder1:
Folder2:...:Filename" as described in Chapter 5, “Objects and References,”
of the AppleScript Language Guide. If you specify only the name of the file
(Filename) instead of its entire pathname, AppleScript attempts to find the file in
the current directory.
For more information about using Load Script to save and load libraries of
subroutines for use in multiple scripts, see Chapter 8, “Handlers,” of the
AppleScript Language Guide.