• 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: Read File Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Read File Problems (From: Lyle Petro <email@hidden>)

  • Prev by Date: Re: Scripting graphics manipulations, improving speed overGraphicConverter 4
  • Next by Date: Re: How to use delimiters in Standard Additions file read/write
  • Previous by thread: Read File Problems
  • Next by thread: Re: Read File Problems
  • Index(es):
    • Date
    • Thread