Re: Read file as short in OS X
Re: Read file as short in OS X
- Subject: Re: Read file as short in OS X
- From: Paul Skinner <email@hidden>
- Date: Thu, 18 Oct 2001 12:29:23 -0400
on 10/18/01 10:21 AM, David Lloyd wrote:
>
I have some scripts that read files as short that work fine in OS9.
>
But under OS X, they break, it seems that AppleScript in OS X doesn't
>
understand what a short is, and throws up an error. Can anyone verify this,
>
and offer a 'just as fast' solution?
>
>
Many thanks,
>
>
David Lloyd
>
> On Tuesday, July 31, 2001, at 09:49 AM, Paul Berkowitz wrote:
>
>
>
>> I think that both of the Chrises did give us detailed run-downs on this
>
>> mailing list of the read/write functionality, including either a couple
>
>> of
>
>> bugs that remain to be fixed (concerning, I believe, the 'as'
>
>> parameter),
>
>> when AS 1.6 was released.
>
>>
>
>> Here's a message from Chris Nebel on May 7, 2001, that I kept: ...
>
>
>
> Nice to know people save these things! The problems Arthur mentions
>
> were introduced in 1.6, and they both have workarounds.
>
>
>
> 1. read ... as short
>
>
>
> Use "as small integer" instead.
>
>
>
> 2. 'write "" to f starting at n' to set the file position
>
>
>
> Use 'read f from n for 0' instead. This is only slightly slower than
>
> using 'write'. Also, you could use the positioning parameters in the
>
> relevant read or write command, instead of seeking beforehand.
>
>
>
> I believe both workarounds work on pre-1.6 systems, but I can't test
>
> that at the moment. I'd also point out that if you're coming back to
>
> read/write after a long absence, read/write as list and as record
>
> actually work now, so there's less need to do your own complex i/o.
>
>
>
>
>
> --Chris Nebel
>
> AppleScript Engineering
--
Paul Skinner