Re: 10.4.9 versus 10.4.10
Re: 10.4.9 versus 10.4.10
- Subject: Re: 10.4.9 versus 10.4.10
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 15 Mar 2008 13:02:22 -0700
- Thread-topic: 10.4.9 versus 10.4.10
On 3/15/08 11:06 AM, "Mark J. Reed" <email@hidden> wrote:
> On Sat, Mar 15, 2008 at 7:32 AM, KOENIG Yvan <email@hidden> wrote:
>> Hello
>>
>> I forgot the way to distinguish these two systems.
>>
>> system attribute "sysv" returns 4169 in both cases.
>
> Right, sysv only gets you the first two components (e.g. 10.4), not
> the third.
Not true. It's just that it doesn't work for 3rd components 10 or higher: it
sticks at 9. It used to work when the third component could not be higher
than 9.
> There's probably a way to get to these numbers directly
> sans shell,
Since OS 10.4.10 (whatever AS version that is), there are now separate
set v1 to system attribute "sys1" --> 10
set v2 to system attribute "sys2" --> 4
set v3 to system attribute "sys3" --> 11
system attribute commands. So
set v to (v1 as string) & "." & v2 & "." & v3
--> "10.4.11"
Easier than doing the old hexadecimal parsing of "sysv" results. To avoid
errors on older systems, use a try block around the new method and the old
method in the error block:
try
set v1 to system attribute "sys1"
set v2 to system attribute "sys2"
set v3 to system attribute "sys3"
set v to (v1 as string) & "." & v2 & "." & v3
--> 10.4.11
on error
set v0 to system attribute "sysv"
set {v1, v0} to {v0 div (16 ^ 3), v0 mod (16 ^ 3)}
set {v2, v0} to {v0 div (16 ^ 2), v0 mod (16 ^ 2)}
set {v3, v4} to {v0 div (16 ^ 1), v0 mod (16 ^ 1)}
set v to (v1 as string) & v2 & "." & v3 & "." & v4
--> 10.3.9
end try
> but this works:
>
> do shell script "sw_vers -productVersion"
--
Paul Berkowitz
_______________________________________________
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