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 11:17:03 -0700
On 4/9/02 3:26 AM, "Philip Aker" <email@hidden> wrote:
>
On Monday, April 8, 2002, at 06:15 PM, Jason Bourque wrote:
>
>
> tell application "Finder"
>
> version
>
> end tell
>
>
> Returns 10.1.2 when it should be 10.1.3
>
>
> Any ideas?
>
>
===
>
on GetSystemVersion()
>
set sysv to system attribute "sysv"
>
set temp to (sysv mod 4096)
>
set vers_major to ((sysv - temp - 256) div 384) as string
>
set vers_minor to (temp div 16) as string
>
set vers_update to (temp mod 16) as string
>
set system_version to vers_major & "." & vers_minor & "." & vers_update
>
end GetSystemVersion
>
>
GetSystemVersion()
>
===
>
>
Be a lot easier if I knew how to use AppleScript's bit shifting
>
operators. ;-/
I'm wondering about this line:
set vers_major to ((sysv - temp - 256) div 384) as string
Since you've only just defined temp as
set temp to (sysv mod 4096)
i.e. the difference sysv - 4096 [you're going to have to revise this routine
anyway if sysv ever hits 8092], that means:
(sysv - (sysv - 4096 - 256) div 384)
= (4096 - 256) div 384
= (3840) div 384
= 10
You might as well just say 10. So this routine is going to be wrong as soon
as we hit OS 11, isn't it? It seems to be valid only for point versions of
OS 10.
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.
--
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.