Re: Finder Version Wrong in OS X
Re: Finder Version Wrong in OS X
- Subject: Re: Finder Version Wrong in OS X
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 09 Apr 2002 12:24:11 -0700
I was all wrong. Forget that last one.
On 4/9/02 11:17 AM, I wrote:
>
Whereas:
>
>
on GetSystemVersion()
>
set sysv to system attribute "sysv"
>
set {vers_major, temp1} to {(sysv div 384), (sysv mod 384)}
>
set {vers_minor, temp2} to {(temp1 div 256), (temp1 mod 256)}
>
set vers_update to (temp2 mod 16)
>
>
set system_version to "" & vers_major & "." & vers_minor & "." &
>
vers_update end GetSystemVersion
>
>
GetSystemVersion()
>
>
>
>
should work for all versions, ancient and modern and yet-to-come, if I've
>
understood the method correctly.
>
No, I didn't have it right either. That 384 was "accidental" to OS X, and it
is derived some other way, With my routine, sysv = 4224 came out as OS
11.0.0 rather than 10.8.0, so that wasn't right. And it suffered from the
same problem as Phil's but with vers_minor - it never gets to 10.2 I was
just guessing wildly (wrongly) as to how 'vers_major' is really derived. As
with Phil's, you never get to 11. (His gets to things like 10.10.0 and
10.64.0 and eventually jumps to 20.0.0 when you hit 8192, not 8092 which I
typed incorrectly last time).
OK, looking at it again, I see that sysv for OS 9.1 was 2320. That's
(9 * 256) + (1 * 16)
I think that with OS 10, we start over, using 4096 as base point rather than
0.
This seems to work in all cases:
on GetSystemVersion()
tell application "Finder" to set sysv to system attribute "sysv"
set {ten_or_higher, temp1} to {((sysv div 4096) as string), (sysv mod
4096)}
if ten_or_higher = "0" then set ten_or_higher to ""
set {vers_major_lastdigit, temp2} to {(temp1 div 256), (temp1 mod 256)}
set {vers_minor, vers_update} to {(temp2 div 16), (temp2 mod 16)}
set system_version to ten_or_higher & vers_major_lastdigit & "." &
vers_minor & "." & vers_update
end GetSystemVersion
GetSystemVersion()
(It would need to be compiled in OS 9 with 'computer' instead of 'system
attribute' to work there and in X, I think.)
--
Paul Berkowitz
_______________________________________________
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.