Re: Gestalt Identifies for X
Re: Gestalt Identifies for X
- Subject: Re: Gestalt Identifies for X
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 05 Jul 2003 17:34:08 -0700
On 7/5/03 2:24 PM, "Gary Lists" <email@hidden> wrote:
>
Could one of you gen-osXers provide me with the value returned from
>
>
-- script code
>
system attribute "sysv"
>
-- end
>
>
for the first X release (the minimal number that I need to test for to
>
evaluate whether I am in X-land)? [1] I did search but didn't find this
>
specific reference.
4096
>
>
Or tell me that I should not (can not) use that method to find the OS
>
version for X. If the latter is the case, what should I be using as an
>
alternative?
>
You can use it.
>
I would like a method that accommodated AS 1.6 and upward, and that would be
>
cross-OS (what do you now call this within the Mac world? xos? crossos?
>
crossmos?)
It's like this:
Beginning with the rightmost digit of the full OS version, after removing
the periods, give each "place" an index, starting with 0. So the index of
the rightmost "place" is 0, second from right is 1, third from right is 2
and fourth from right is 3. Make each index the exponent of 16 for the digit
in that place, and multiply the digit by this 16-based result. Calculate
each of these hex-integers as decimal numbers and add them all together. In
other words, for OS 9.2.1:
1 * (16^0) = 1
2 * (16^1) = 32
9 * (16^2) = 2304
TOTAL = 2337
for OS 10.0.0:
0 * (16^0) = 0
0 * (16^1) = 0
0 * (16^2) = 0
1 * (16^3) = 4096
You'll notice that it's not 10 * (16^2).
OS 10.2.6 :
6 * (16^0) = 6
2 * (16^1) = 32
0 * (16^2) = 0
1 * (16^3) = 4096
TOTAL: 4134
system attribute "sysv" -- I'm running 10.2.6
--> 4134
However, you'll get an error in OS 8.x/9.0.x unless you put this inside a
Finder tell block. (I forget which version of AS 'system attribute' came in:
I think it may have been AS 1.5.5/OS 9.1, but maybe it was AS 1.6/OS 9.2.)
It's backward compatible with
tell application "Finder" to get computer "sysv"
in the older versions of AS/OS. It will compile to 'system attribute' on a
later OS but will re-compile as 'computer' on the earlier OS as long as you
put it into a Finder block. It will run on all OS and AS versions in a
Finder tell block.
--
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.