• 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: How to use delimiters in Standard Additions file read/write
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use delimiters in Standard Additions file read/write


  • Subject: Re: How to use delimiters in Standard Additions file read/write
  • From: Nigel Garvey <email@hidden>
  • Date: Sun, 18 Mar 2001 19:59:48 +0000

Charles Arthur wrote on Sun, 18 Mar 2001 10:40:13 +0000:

>However my script
> ----
>set thefile to choose file
>open for access thefile
>set theend to get eof of thefile
>--display dialog (theend & " bytes") as string -- used in earlier
>debugging
>set thelist to read thefile using delimiter {" "}
>close access thefile
>----
>fails at the "set thelist to..." point with "parameter error".

Try reading the file 'as list using delimiter {" "}'.

If you're just reading the file, there's no need to open it for access
explicitly.

set thefile to choose file
set thelist to read thefile as list using delimiter {" "}

However, if you do have to open it for access, I'd recommend referring to
it by the open file reference rather than the file specification while
it's open:

set thefile to choose file
set fileRef to open for access theFile
set thelist to read fileRef as list using delimiter {" "}
close access fileRef

This is marginally faster and helps to avoid errors if for some reason
the file's still open from a previous run, or if more than one person is
accessing the file at any particular time.

NG


  • Prev by Date: Repeat-Handler-Cancel
  • Next by Date: Re: How to use delimiters in Standard Additions file read/write commands?
  • Previous by thread: Repeat-Handler-Cancel
  • Next by thread: Re: How to use delimiters in Standard Additions file read/write
  • Index(es):
    • Date
    • Thread