Detect OS 9 or OS 10

Hi all, I’m sure this has been covered somewhere else but I can’t seem to find an answer to it, although I should think it’s not that difficult.

I’m making an autostart script for my Director CD and I just want a simple script to determine whether the person is running OS X or a pre OS X system. I don’t need specific details on the version just a yes or no basically.

The only thing I’ve found on this forum was this somewhat complicated example: http://bbs.applescript.net/viewtopic.php?t=8460

and I was hoping someone else knew a simpler way to do it.

Cheers,

Paul

Hi, Paul.

If you’re compiling the script in OS X:

tell application "Finder"
  set pre_X to ((system attribute "sysv") < 4096) -- true if the running system is earlier than OS X; false otherwise
end tell

If you’re compiling the script on a system earlier than OS X, write it like this:

tell application "Finder"
  set pre_X to ((computer "sysv") < 4096)
end tell

‘system attribute’ in OS X has the same token as ‘computer’ in OS 8/9, so the underlying compilation will be exactly the same. If you compile the script on one system and then view it in a script editor on another, you’ll see the keyword appropriate to that system. Although ‘system attribute’ doesn’t require the Finder, ‘computer’ does; so you need the Finder ‘tell’ block to make it work on any system.

Hi Paul,

Can I say what you mean by the autostart script?
Is it autoruning a CD title when it is inserted?

Cheers,