Scripting Additions Guide

CHAPTER 2
Scripting Addition Commands
Using Read/Write Commands 71
ERRORS
Using Read/Write Commands 2
The commands provided by the Read/Write Commands scripting addition
allow you to open a file for access, get and set its length, read data from the file,
insert new data in the file, and close access to the file. These commands allow
you to make use, from within a script, of some capabilities of the File Manager,
the part of the Macintosh Operating System that controls files.
W A R N I N G
The Read/Write Commands scripting addition is intended
for use by experienced programmers. If you are not
familiar with the File Manager as described in Inside
Macintosh: Files, proceed with caution. Using these
commands incorrectly may cause loss of data.
Most of the Read/Write Commands allow you to specify a file reference
number instead of a reference to a file. A file reference number is an integer,
assigned by the File Manager, that uniquely identifies a file. You can obtain a
file reference number with the Open for Access command, then use the number
returned to refer to the same file until you use the Close Access command to
close the file. It is usually preferable to specify a file reference number rather
than a reference to a file because it takes the Read/Write Commands scripting
addition less time to locate the file.
Error
number Error message
–34 Disk <name> is full.
–38 File <name> wasn't open.
–44 Disk <name> is write protected.
–45 File <name> is locked.
–49 File <name> is already open.
–50 Parameter error.
–51 File reference number error.
–61 File not open with write permission.
–108 Out of memory.