• 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: EOF madness!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOF madness!


  • Subject: Re: EOF madness!
  • From: "Arthur J Knapp" <email@hidden>
  • Date: Wed, 11 Apr 2001 11:03:19 -0400

> Date: Tue, 10 Apr 2001 10:28:24 -0400
> From: bRaD Weston <email@hidden>
> Subject: EOF madness!

> I am trying to read a text file until eof and Applescript has lost
> its mind. It is only reading the first 25 - 29 characters of the file
> and thinks it's done. Other machines seem to work fine with this ever
> so simple script. Any ideas? This is the latest trial, but there have
> been several before this:
>
> set the tempFile to open for access file sourceFile without write permission
> set rawData to read tempFile from 1 until eof

The "until" parameter, (as defined by the "read" command's dictionary
entry), takes a string to read until, (actually, a single character).

If you need to read an entire file, you don't have to specify any
indexes at all:

set the tempFile to open for access file sourceFile
set rawData to read tempFile

If you don't need to do anything with the file except read the
entire thing into memory, don't even need to open for access,
AppleScript will open and close it for you:

set rawData to read sourceFile

The AppleScript Scripting Additions Guide has information on using
the read/write commands. The Guide is *extremely* old at this point, but
it is still the most informative resource for the read/write commands:

<http://developer.apple.com/techpubs/mac/scriptingadditions/ScriptAdditions-
2.html>

I would really like someone authoritative to come up with some really
good documentation for using the commands of Standard Additions, but Apple's
stance has always been to just tell people to "see the dictionary".


Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
http://www.LateNightSW.com


  • Follow-Ups:
    • Re: EOF madness!
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: «event XUVJdtdl» Error
  • Next by Date: How to reliably get an application's creator type on MacOS X
  • Previous by thread: Re: EOF madness!
  • Next by thread: Re: EOF madness!
  • Index(es):
    • Date
    • Thread