Re: How to use delimiters in Standard Additions file read/write commands?
Re: How to use delimiters in Standard Additions file read/write commands?
- Subject: Re: How to use delimiters in Standard Additions file read/write commands?
- From: Devon and Cornwall <email@hidden>
- Date: Sun, 18 Mar 2001 09:37:53 -0800
At 10:40 AM +0000 3/18/01, Charles Arthur wrote:
>
I'm interested in the file commands of the Standard Additions for reading
>
(and doing fast TID-based search+replace).
>
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".
If you just want the words of a file in a list you can use either of these:
set thefile to choose file
set filRef to open for access thefile
set thelist to read filRef using delimiter {" "}
close access filRef
thelist
or (a little faster)
set thefile to choose file
set filRef to open for access thefile
set thelist to words of (read filRef)
close access filRef
thelist
HTH
Devon and Cornwall