Name

get eof

Synopsis

get file end position

get file end position

Returns the index of the last character of a file (which is also the size of the file). Because character position values start at 1, and because the eof is the position of the last character, if you want to append to a file you must start writing at a position one greater than the eof (and that is the largest position at which you are permitted to start writing).

Example

write "Howdy" to f
set ourEof to get eof of f
write "Doody" to f starting at ourEof + 1

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.