Re: Writing Binary Files, Data Code Limitations, and Unicode Tables (not necessarily in that order)
Re: Writing Binary Files, Data Code Limitations, and Unicode Tables (not necessarily in that order)
- Subject: Re: Writing Binary Files, Data Code Limitations, and Unicode Tables (not necessarily in that order)
- From: Nigel Garvey <email@hidden>
- Date: Sun, 23 Nov 2003 01:36:28 +0000
kai wrote on Sat, 22 Nov 2003 22:19:45 +0000:
>
on Sat, 22 Nov 2003 18:06:25 +0000, Nigel Garvey wrote:
[Fairly good script snipped]
>
Drat!
>
>
Actually, that's very, very nifty, Nigel. :-)
>
>
But "drat!" anyway - since I'd just come up with the following, and you beat
>
me to it (both in terms of posting *and* of performance):
Actually, on my machine, they take about the same time - and yours is
somewhat briefer. :-)
>
--------
>
>
script s
>
set s to ""
>
repeat with n from 0 to 255
>
set s to s & (ASCII character n)
>
end repeat
>
s
>
end script
>
>
property p : run script s
[...]
>
repeat with t in p
Drat! Of course! What an idiot I am! OK. Change this in my second script:
>
repeat with i from 0 to 65535 by 16
>
set hi to my asciiChars's item (i div 256 + 1)
>
set AppleScript's text item delimiters to hi
>
get hi & my asciiChars's items (i mod 256 + 1) thru (i mod 256 + 16)
>
write result to fileRef
>
end repeat
... to this:
repeat with i from 1 to 256
set hi to my asciiChars's item i
set AppleScript's text item delimiters to hi
get hi & asciiChars
write result to fileRef
end repeat
Timings on my G3 400, OS 9.2.2:
Mike's original: 416 seconds (6 min 56 sec)
BJ's version: 288 seconds (4 min 48 sec)
Kai's: 18 seconds
My first: 18 seconds
My second: 6 seconds
My last (with the Kai Insight): 1 second
Good night. :-)
NG
PS. I've just seen Kai's latest version in the Web archive, which looks
essentially the same as mine. :-)
_______________________________________________
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.