Writing without opening (was: Login Applescript won't write to file)
Writing without opening (was: Login Applescript won't write to file)
- Subject: Writing without opening (was: Login Applescript won't write to file)
- From: Sun Real <email@hidden>
- Date: Sat, 30 Jun 2001 12:09:58 +1000
Deivy Petrescu's message of 30/6/01 2:42 AM contained:
>
>The file is not opened for access anywhere in what you posted and opening
>
>for access with write permission is required in this case.
>
>
I am replying because of this line. No, it does not!
Deivy,
OK, it does work when run from Script Editor & I'll take your word for it
on the OSA Menu. This is all & well, but Mr Wilkinson is not having
trouble running it in either of these 2 ways.
From the Standard Additions dictionary:
write: Write data to a file that was opened for access with write
permission
The 'read' command can also work without an explicit 'open for access'
and these behaviours are neither documented (as far as I can see) nor
particularly reliable. I used to use 'read' without an explicit open & I
found that it would sometimes fail, so I stopped using it like that.
Nigel Garvey has, I believe, looked at the situations in which 'read'
tends to fail; Shane Stanley has noted that he also uses the official
method due to intermittent failures, if I recall correctly.
Given that intermittent failure is what's happening in the script under
discussion, I'm suggesting that using the command in the documented way
might be a good place to start trying to work out what's wrong with it.
Rather than assume it is working, let's try to prove it & see if we can
actually get the script working for him.
Cheers,
Richard Morton
-- Great Lies of the Music Business: "Your timing is great"