Scripting Additions Guide
Table Of Contents
--OpenFileIfItExists returned a file reference number
--do your work with the open file here
close access z
end if
The OpenFileIfItExists handler shown in Listing 2-4 takes two
parameters:
theFile A string that consists of the full pathname for the file to open
or create.
writePermission
A Boolean value that indicates whether to open the file with
(true) or without (false) write permission.
To determine whether the file exists or not, OpenFileIfItExists uses the
Info For command. If the file doesn’t exist, the Info For command returns
error –43, “File wasn’t found,” and OpenFileIfItExists displays a dialog
box that allows the user to choose whether to create the new file. If the file
exists or if it is successfully created, OpenFileIfItExists opens it with or
without write permission, depending on the value of the writePermission
parameter.