Re: Writing To A File
Re: Writing To A File
- Subject: Re: Writing To A File
- From: Deivy Petrescu <email@hidden>
- Date: Tue, 30 Sep 2003 12:52:32 -0400
On Tuesday, Sep 30, 2003, at 09:20 US/Eastern, Steve Mills wrote:
On Monday, Sep 29, 2003, at 23:08 US/Central, Richard Morton wrote:
Yep. As Paul B pointed out, 'open for access' has nothing to do with
the Finder. These commands are part of the Standard Additions osax.
Yes, I know it's a standard addition. I was illustrating what not to
do. As for how bulletproof these commands are, I disagree. Run this
twice:
tell application "Finder"
set rn to open for access "Gort:Users:sjmills:Desktop:testblah" with
write permission
write "bob" to rn
close access rn
end tell
One the 2nd run, I get "Finder got an error: Duplicate file name. some
object". Take out the Finder targeting and I get "Duplicate file name.
Gort:Users:sjmills:Desktop:testblah".
Now add the class "file" before the pathname and it works. Clearly,
it's a bug that it doesn't work a 2nd time if you pass a pathname
string. THIS is the problem I always have, and it's not obvious that I
have to remember to type "file" in front of it, because almost every
other app or command I regularly use that takes a file reference works
no matter what when I pass a pathname string instead of a file or
alias. If other apps and commands are written to be smart enough to
always accept a string, then these commands should be too.
I fully agree it is a bug.
But wouldn't it be nice if you did not have to open for access the
file? Well you do not, just go ahead and write to a file *without*
opening it for access....
Isn't life great?
Yeah, I'm cranky this morning because the new idiot that delivers the
stupid newspaper in the neighborhood has an old Prelude with a
euro-racer-geek-boy muffler which wakes me up far too early.
He probably doeshave to stay up later debugging his Applescript scripts.
After you finish debugging your AS scripts, go celebrate in front of
his house...
Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/
Regards
Deivy Petrescu
http://www.dicas.com/
_______________________________________________
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.