• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What System?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What System?


  • Subject: Re: What System?
  • From: Nigel Garvey <email@hidden>
  • Date: Tue, 23 Aug 2011 21:46:27 +0100

Luther Fuller wrote on Tue, 23 Aug 2011 11:03:40 -0500:

>On Aug 23, 2011, at 10:40 AM, Robert Poland wrote:
>
>> Could someone tell me what the latest Applescript code is to get the
>>current operating system?
>
>I was looking into that recently, but couldn't find the script. Perhaps
>didn't save it.
>A quick check of version commands gives me ...
>
>system attribute "sysv" --> returns a hex value

That's almost the oldest method and still my favourite simply because it
works on any OS X system (except 10.4.10 and 10.4.11). The "hex" value
returned is binary coded decimal. So on my SL system, system attribute
"sysv" returns 4200, the hexadecimal for which is 1068, showing that the
system version's 10.6.8. To find out if the system's Lion, a simple way
would be:

  set lionSystem to ((system attribute "sysv") div 16 = 263)

When Tiger went up to sub-version 10, "sysv" stuck on hex 1049 and three
new system attributes — "sys1", "sys2", and "sys3" were invented to
return the three parts of the system version. Thus for Lion, the even
simpler:

  set lionSystem to ((system attribute "sys2") = 7)

There's also a system attribute for the AppleScript version: "ascv", but
you have to mod the result by 4096 and look at what's left. When
AppleScript 1's subversions went up to ten, the hex digits involved
simply went up to A.

Prior to Mac OS 9, the 'system attribute' token belonged to a Finder
command called 'computer' which did exactly the same thing.
Interestingly, in Snow Leopard, I can still type …

  tell application "Finder" to get computer "sysv"

… and it'll compile as …

  tell application "Finder" to get system attribute "sysv"

So in a Finder 'tell' statement, this method works for any Mac system
from at least the past 15 years.

Please excuse the history lesson.  :)

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

  • Prev by Date: Re: What System?
  • Next by Date: Re: What System?
  • Previous by thread: Re: What System?
  • Next by thread: Re: What System?
  • Index(es):
    • Date
    • Thread