Re: Close Access
Re: Close Access
- Subject: Re: Close Access
- From: Timothy Bates <email@hidden>
- Date: Tue, 29 Jan 2002 12:08:45 +1100
On 27/1/02 7:53 PM, "John McAdams" <email@hidden> wrote:
>
Hi List,
>
>
I was just reading through the "read" section of "AppleScript in a
>
Nutshell." On p.462 Mr Perry suggests using "close access" after
>
reading. However when I try this (in X, haven't tried it in 9), I get an
>
error that the file isn't open. Now, all psyched up at the prospect of
>
finding a bug, I post the observation.
>
>
To wit--on p.463 Mr Perry suggests using "read theFile before return"
>
within a "repeat number_of_file_lines times" statement to "neatly read
>
the file line by line." My attempts neatly read the entire file
>
"number_of_file_lines" times. Bug? Or old news?
If you don't open it, you don;t need to close it.
So, if you say
set f to open for access alias "Cortex:Users:tim:Desktop:pepper:anne sql"
set stuff to read f
close access f
-->stuff
If works.
But if you say
set stuff to read alias "Cortex:Users:tim:Desktop:pepper:anne sql"
close access f
Close gives an error. So, if read has to open the file, it kindly closes it
for you, obviating the need for your own close.
References: | |
| >Close Access (From: John McAdams <email@hidden>) |