• 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: Any way to get "file pointer"?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to get "file pointer"?


  • Subject: Re: Any way to get "file pointer"?
  • From: Shane Stanley <email@hidden>
  • Date: Sat, 02 Jun 2018 12:22:52 +1000

On 2 Jun 2018, at 10:18 am, Gil Dawson <email@hidden> wrote:
>
> I'm looking for the number of bytes I've read so far.

The short answer, as Chris said, is that there is no such command.

The longer answer is that both your code and proposed workaround are based on
using the default encoding, which in most cases means MacRoman. And unless
you're also writing the original files in AppleScript, or you know they will
never include characters outside the strict ASCII set, that's a recipe for
corruption. Virtually nothing writes text files in MacRoman these days, and
certainly not with linefeeds as line breaks.

Also, using read with a delimiter repeatedly instead of just reading and
getting the paragraphs was, last I checked, a much, much slower option.

And if you move to more sensible encoding like UTF-8, keeping track of the file
mark is generally fraught with danger anyway, because you lose the equivalence
of bytes and characters.

--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Any way to get "file pointer"? (From: Gil Dawson <email@hidden>)
 >Re: Any way to get "file pointer"? (From: Steve Mills <email@hidden>)
 >Re: Any way to get "file pointer"? (From: Gil Dawson <email@hidden>)

  • Prev by Date: Re: Any way to get "file pointer"?
  • Next by Date: AppleScripting Contacts - cannot add a person to a group
  • Previous by thread: Re: Any way to get "file pointer"?
  • Next by thread: Re: Mysterious OSX Mail scripting problem [solved!]
  • Index(es):
    • Date
    • Thread