I would like to tell an application to save a new document in a particular file. Whey I try
set fileSpec to ((fileFolder as string) & fileName) as file
save document 1 in fileSpec
I get an error saying that the file does not exist. Well of course not, that is why I am trying to save it!
How does one create a file spec or alias for a file that does not exist yet? Using a dialog is not an option.
: I would like to tell an application to save a new
: document in a particular file. Whey I try
: set fileSpec to ((fileFolder as string) & fileName)
: as file
: save document 1 in fileSpec
: I get an error saying that the file does not exist. Well
: of course not, that is why I am trying to save it!
: How does one create a file spec or alias for a file that
: does not exist yet? Using a dialog is not an option.
You can’t create an alias for a file that doesn’t exist. For commands that create a file and save to it, you must use a path string: “Disk:Folder:Subfolder(s) (if applicable):Filename”. So leave off the ‘as file’ in your first line. Depending on your application, you may have to insert the word ‘file’ before the path string when writing to or reading from it:
save document 1 in file fileSpec
Hope this solves the problem.
NH
: You can’t create an alias for a file that doesn’t exist.
: For commands that create a file and save to it, you
: must use a path string: “Disk:Folder:Subfolder(s)
: (if applicable):Filename”. So leave off the ‘as
: file’ in your first line. Depending on your
: application, you may have to insert the word ‘file’
: before the path string when writing to or reading from
: it: save document 1 in file fileSpec
: Hope this solves the problem.
: NH
Yes, thanks. So what is the difference between
save document 1 in (stringexpr as file)
and
save document 1 in file stringexpr
(aside from the face that one works and the other does not?)