• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Close Access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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>)

  • Prev by Date: Recursion Problems
  • Next by Date: Re: storing locally web form data submitted on a local browser
  • Previous by thread: Re: Close Access
  • Next by thread: Re: Close Access
  • Index(es):
    • Date
    • Thread