Re: What System?
Re: What System?
- Subject: Re: What System?
- From: Nigel Garvey <email@hidden>
- Date: Thu, 25 Aug 2011 06:39:46 +0100
I wrote on Thu, 25 Aug 2011 00:45:51 +0100:
>"koenig.yvan" wrote on Wed, 24 Aug 2011 23:55:13 +0200:
>
>>I don't remember the sysv values returned for 10.4.10 and 10.4.11 but
>>knowing them it would easy to get rid of these two odd cases.
>>
>>set maybe to system attribute "sysv"
>>if maybe = system_10410_value then
>>return "10.4.10"
>>else if maybe = system_10411_value then
>>return "10.4.11"
>>else
>>-- here the standard treatment
>>end if
>
>"sysv" stayed at 4169 (OS 10.4.9) for those two. New "sys1", "sys2", and
>"sys3" attributes for identifying OS 10.4.10 were introduced in … OS
>10.4.10! So:
>
> set maybe to (system attribute "sysv")
> if (maybe is 4169) then -- (OS 10.4.9/10/11)
> try
> "10.4." & (system attribute "sys3")
> on error
> "10.4.9"
> end try
> else
> -- etc.
> end if
On further reflection, I'm pretty sure that a non-existent system
attribute would return an empty string rather than erroring, so:
set maybe to (system attribute "sysv")
if (maybe is 4169) then -- (OS 10.4.9/10/11)
set couldbe to (system attribute "sys3")
if (couldbe is "") then
"10.4.9"
else
"10.4." & couldbe
end if
else
-- etc.
end if
Given the accumulated wisdom expressed in this thread and the fact that
'system info' was apparently introduced with Tiger, a sensible
"universal" method might be:
tell application "Finder" to set sysv to (system attribute "sysv")
if (sysv < 4160) then -- Pre 10.4.0
if (sysv < 4096) then -- Pre 10.0.0
set sysVersion to "" -- No tens digit in the major version number.
else
set sysVersion to "1"
end if
set sysVersion to sysVersion & (sysv mod 4096 div 256) & "." & (sysv mod 256 div 16) & "." & (sysv mod 16)
else
set sysVersion to (system info)'s system version
-- Or: do shell script "sw_vers -productVersion"
end if
This of course would have to be compiled on a post-Panther system and
would need modification if system attribute "sysv" were to be
discontinued in the future. But then the future's always an unknown
country in AppleScript.
NG
_______________________________________________
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