Can someone assist me in finding an applescript that will return the current OS? I am running a program in both OS 9.2 and Classic OS X - I need to find out what OS I am running during run time.
I am not running OS X
but this will return the current OS
tell application “Finder”
version
end tell
Actually, that will return the version of the Finder. It might be close enough for some things, but it won’t always reflect the current OS. For instance, I’m running OS X 10.2.3 but the script above returns 10.2.
Try this:
sniffOSvers()
on sniffOSvers() -- credits to Kai Edwards
try
tell application "Finder" to set {x, y} to {"", system attribute "sysv"}
on error number -1708 -- event not handled (no AS 1.6 commands in Classic)
set {x, y} to {"", 4096}
end try
repeat with n from 3 to 0 by -1
tell 16 ^ n to set {x, y} to {x & (y div it), y mod it}
end repeat
tell x as integer as string to set x to it's text 1 thru -3 & "." & it's character -2 & "." & it's character -1
return x
end sniffOSvers