Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript-Studio Digest, Vol 5, Issue 110




Message: 2
Date: Tue, 27 May 2008 17:42:48 +0200
From: Andreas Kiel <email@hidden>
Subject: OS Version script
To: email@hidden
Message-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Hi all,

Maybe a stupid question again. I got following script part:

on getOS()
try
set the hexData to system attribute "sysv"
set hexString to {}
repeat 4 times
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
set the OSversion to the hexString as number
log {"OSversion", OSversion}
on error theError
log {"OS version not found", theError}
set OSversion to 1000
end try
return OSversion
end getOS

running this on my machine the above returns 1049

looking at the "About This Mac" tells me 10.4.11.
It's not that important - but what's happening there?

Andreas

You can use "considering numeric strings"

From here (http://homepage.mac.com/swain/Sites/Macinchem/Applescript/page2.html)

Comparing version numbers however is not so straightforward since the version number could be 2.10.3 or 2.3.10, fortunately Apple have kindly provided a simple means to compare this type of numeric strings. So using "considering numeric strings". 

considering numeric strings
if babel_version > "2.1" is true then --> true, if you consider each numeric string to be a single "character".
display dialog "True" 
end if
end considering 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.