Re: Finder Version Wrong in OS X
Re: Finder Version Wrong in OS X
- Subject: Re: Finder Version Wrong in OS X
- From: Philip Aker <email@hidden>
- Date: Tue, 09 Apr 2002 11:56:52 -0700
On Tuesday, April 9, 2002, at 10:09 AM, Phil Dobbin wrote:
===
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()
===
Any chance of a line by line commenting so I can grok it
(off-list if you prefer)?
I was kinda hoping some math whiz would step in and show how
it's _supposed_ to be done. ;-)
set sysv to system attribute "sysv"
Gets the version as an unsigned long. I believe this is the
'whole' member of the NumVersionVariant union defined in
MacTypes.h (from Universal Headers).
set temp to (sysv mod 4096)
Get the minor and update portion
set vers_major to ((sysv - temp - 256) div 384) as string
Mask off the minor and update portions. Calculate the major
version from that.
set vers_minor to (temp div 16) as string
Minor version in the high 4 bits.
set vers_update to (temp mod 16) as string
Update version in the low 4 bits.
Philip Aker
http://www.aker.ca
_______________________________________________
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.