Scripting Additions Guide

CHAPTER 2
Scripting Addition Commands
70 Command Definitions
To set the file mark without reading or writing data, write a string of zero
length to the byte to which you want to set the mark. For example, this script
sets the file mark for the file specified by fileRefNum to the fourth byte in
the file:
write "" to fileRefNum starting at 4
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
The Write command attempts to match a reference to a file or an alias with a
file previously opened with the Open for Access command. If a match is found,
it simply writes the specified data. If no match is found but the file can be
located on disk, the Write command opens the file, writes the specified data,
then closes the file. The file mark for a file opened in this fashion is always
at the beginning of the file. If the file cannot be found at all, the Write command
returns an error.
If you specify a file reference number previously obtained with the Open for
Access command, the Write command writes the specified data immediately.