Re: Checking the OS Version?
Re: Checking the OS Version?
- Subject: Re: Checking the OS Version?
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 08 Aug 2002 11:25:02 -0700
On 8/8/02 10:39 AM, "email@hidden" <email@hidden> wrote:
>
I know that this is possible, because I recall seeing the code somewhere,
>
but now I can't find it.
>
>
How do I determine what OS the script is running under? The delineations
>
can just be "Is it 10?", if that's what I can get.
>
The simple way that's meant to work :
tell application "Finder" to get system version
doesn't.
If it's good enough for you, you can use
tell application "Finder" to get version as string
will get you the Finder's version, which should be good enough under the
conditions you state. ('as string' is not needed in recent versions, but is
needed for older versions if you want to do comparisons). The Finder's
version in OS 10.1.5, is still 10.1.2 for example, and in some incarnations
has letters tacked on to the end. it won't immediately coerce to a number,
but:
tell application "Finder" to set vers to version as string
set AppleScript's text item delimiters to {"."}
set mainVers to text item 1 of vers
set AppleScript's text item delimiters to {""}
set mainVers to mainVers as integer
--10
should do what you want.
Another, better, way is to
tell application "Finder" to computer "sysv"
(In OS X, that will compile as:
tell application "Finder" to system attribute "sysv"
)
If the result is 4096 or higher, it's OS 10 or higher. I've forgotten how
that works, but there's a way of figuring it all out.
--
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.