• 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: Scripting Additions 'Read' has stopped reaching EOF?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Additions 'Read' has stopped reaching EOF?


  • Subject: Re: Scripting Additions 'Read' has stopped reaching EOF?
  • From: "John W. Baxter" <email@hidden>
  • Date: Mon, 26 Jan 2004 10:06:23 -0800

Hmmm...your follow ups makes me doubt my first guess, but I'll post it
anyhow:

Is there any chance that the data file lacks a newline ending the last line?

I think that's not the problem, since you say "identical" in one of the
follow ups.

It shouldn't matter, but I've become sensitized to that problem.

--John


On 1/25/2004 16:38, "Chap Harrison" <email@hidden> wrote:

> Never mind. It sees EOF again.
> Nothing that restarting OS X couldn't cure, it seems.
> (I had cycled Filemaker, Entourage, Script Editor, and Script Debugger
> several times without success).
>
> Chap
> Gusev Crater
>
>
> On Jan 25, 2004, at 5:07 PM, Chap Harrison wrote:
>
>> orders.txt is a raw ASCII file containing records, which contain
>> fields.
>>
>> The fields are delimited with fs (ASCII 28), and the records are
>> delimited with rs (ASCII 30). The fields may contain any typeable
>> ASCII characters, including newlines. There are no non-ASCII (>127)
>> bytes in the file.
>>
>> *** top of file ***
>> 111 f 22222 f 333333 f 44444 f 55555 f r
>> :
>> :
>> 11111 f 22 f 333333 f f 55555 f r
>> *** end of file ***
>>
>> f = ASCII 28, r = ASCII 30. Digits represent ASCII data.
>>
>> I was successfully reading these records up until very recently! I've
>> done nothing to change the format of the ASCII file, nor do I *think*
>> I've touched anything in the Applescript that's involved with reading
>> each record from the file into an Applescript list.
>>
>> Now, it reads okay up through the final record. On the next read,
>> instead of entering the 'on error' block indicating it's hit EOF, it
>> continues to return a portion of the final record!! And I'm using the
>> "right" delimiter characters for fs and rs now. Any ideas what
>> happened, or at least how to read dependably?
>>
>> Thanks, Chap
>>
>>
>> -- begin script
>> property gParsePath : (path to (documents folder) from (user domain)
>> as string) & "orders.txt"
>> try
>> set fid to (open for access gParsePath)
>> on error
>> display dialog "Couldn't open " & gParsePath & " for input."
>> return
>> end try
>> repeat
>> try
>> set gDataList to (read fid before (ASCII character of 30) using
>> delimiter (ASCII character of 28))
>> on error myErrMsg number myErrNo
>> close access fid
>> display dialog "EOF"
>> exit repeat
>> end try
>> end repeat
>> -- end script
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Scripting Additions 'Read' has stopped reaching EOF?
      • From: Chap Harrison <email@hidden>
References: 
 >Re: Scripting Additions 'Read' has stopped reaching EOF? (From: Chap Harrison <email@hidden>)

  • Prev by Date: Re: Still more strange things S(
  • Next by Date: Re: applescript and browsers
  • Previous by thread: Re: Scripting Additions 'Read' has stopped reaching EOF?
  • Next by thread: Re: Scripting Additions 'Read' has stopped reaching EOF?
  • Index(es):
    • Date
    • Thread