Scripting Additions Guide

CHAPTER 2
Scripting Addition Commands
20 Command Definitions
PARAMETER
referenceToFile A reference of the form file nameString or alias nameString,
or a file reference number returned by a previous call to the
Open for Access command (see “Notes”).
Class: Reference or integer
RESULT
None
EXAMPLES
This example closes the file named To Donald in the specified location if it was
previously opened with the Open for Access command.
tell application "Scriptable Text Editor"
close access file "Hard Disk:Letters:To Donald"
end tell
The next example closes the file associated with the file reference number if the
value of myFileRefNumber is a file reference number previously obtained
with the Open for Access command.
tell application "Scriptable Text Editor"
close access myFileRefNumber
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.