Re: Read File Problems
Re: Read File Problems
- Subject: Re: Read File Problems
- From: Chris Nebel <email@hidden>
- Date: Tue, 20 Mar 2001 17:57:44 -0800
- Organization: Apple Computer, Inc.
Lyle Petro wrote:
>
I would really appreciate some help with syntax problems I am having with the read command. I would like to read a portion of a file into a list. This list would be delimited by the return character. For example:
>
>
set chkFile to choose file
>
set fStart to 1
>
set fStop to 600
>
open for access chkFile
>
set fEnd to get eof chkFile
>
if fEnd < fStop then set fStop to fEnd
>
read file chkFile as list using delimiter "\r" from fStart to fStop
>
close access chkFile
>
>
I keep getting parameter errors with all variations of syntax. Am I attempting the impossible using the Standard Read/Write addition?
Luckily no, but the fix is not exactly obvious. Change the "as list" to "as text" and it should do what you want. The pre-1.6 read command has a bunch of restrictions that kick in if you use "as list", most of which
are unjustified and were removed in 1.6.
--Chris Nebel
AppleScript Engineering