Re: Writing out a file bug?
Re: Writing out a file bug?
- Subject: Re: Writing out a file bug?
- From: John Delacour <email@hidden>
- Date: Fri, 15 Aug 2003 00:19:32 +0100
At 11:09 am +0100 14/8/03, Nigel Smith wrote:
I *thought* that, if you let the user choose where to save the file and they
choose to overwrite an existing file, pressing "Replace" in the ensuing
dialog, that the OS would take care of this.
choose file name: Get a new file reference from the user, without
creating the file
All this osax does is give you the file specification or rather (in
OS X) the POSIX file <<class furl>> which amounts to the same thing
in practice. Neither needs to exist. No file is created or
overwritten.
set f to choose file name with prompt "Get a furl..." default
location (path to desktop) default name "I may not exist after this"
{f, class of f}
--> {file "dxp:Users:jd:Desktop:I may not exist after this", <<class furl>>}
tell app "Finder" to f exists
--> false
open for access f with write permission
set eof f to 0
write "aaaaa" to f
close access f
Does this mean that we should always set the destination eof to 0, just in
case they choose to save over an older version?
Yes.
You don't need to get a refnum for f. It's far more convenient just
to use f because f will go places refnum won't.
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.