Scripting Additions Guide

CHAPTER 2
Scripting Addition Commands
42 Command Definitions
PARAMETERS
referenceToFile
A reference of the form file nameString or alias nameString. If
you specify an alias, the file must already exist, because
AppleScript must locate the file before running the script. If you
specify a file that doesn’t exist using the form file nameString,
Open for Access creates a TeachText document of that name at
the specified location and opens it for access.
Class: Reference
Boolean An expression that evaluates to true or false. If it evaluates to
true, AppleScript opens the file with read and write
permission. If it evaluates to false or if this parameter is
omitted entirely, AppleScript opens the file with read
permission only. Note that the phrase with write
permission is equivalent to the phrase write permission
true; similarly, without write permission is equivalent
to write permission false.
Class: Boolean
RESULT
File reference number.
EXAMPLE
This example opens the file named To Donald in the specified location for
subsequent access with the Read command.
tell application "Scriptable Text Editor"
open for access file "Hard Disk:Letters:To Donald"
end tell
The next example opens the file associated with the file reference number for
subsequent access with the Read or Write command.