Re: Saving a temp file?
Re: Saving a temp file?
- Subject: Re: Saving a temp file?
- From: John Delacour <email@hidden>
- Date: Wed, 12 Feb 2003 22:42:13 +0100
- Mac-eudora-version: 6.0a5
At 2:25 pm -0500 12/02/03, James Burns wrote:
I'm taking a cue from another app and saving the file to
/private/tmp/tempFile, but I get an error if the file already exists.
try
set fileRef to (open for access tempFile with write permission)
set eof of fileRef to 0
write fileContents to fileRef
close access fileRef
on error what
display dialog what
close access fileRef
end try
I'd appreciate any help in this matter. What I basically have to do
is save a file without confirmation or user intervention, and then
it can be deleted on quitting.
You must have left the file open at some point. At any rate whatever
error you are getting has nothing to do with the existence of the
file.
You can run this ad nauseam with any value of s and fName and get no error:
set s to "some text..."
set fname to "junk.txt"
set f to "" & (path to "temp") & fname
open for access file f with write permission
set eof file f to 0
write s to file f
close access file f
tell app "Finder" to open file f
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.