• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OS version questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OS version questions


  • Subject: Re: OS version questions
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 18 Jul 2003 18:28:57 -0700

On 7/18/03 5:29 PM, "Nigel Garvey" <email@hidden>
wrote:

> Currently, if such a script is saved in 9.2.2 or 10.2, or as an
> X-compatible app in earlier versions of 9, it'll be viable in X and in
> any previous system where CarbonLib is installed and usable. However, it
> won't open in 8 if it contains a 'system attribute' command. If it's
> saved in 8, it'll only be viable in 8 or 9. Whether or not it'll actually
> *work* on any particular system depends on the individual peculiarities
> of the target software and the way the script's written. It's very rare
> for a script written for one of the earlier Finders to work in X without
> extra splints and rubber bands.

Whoa, Nigel! 'system attribute' is backwards compatible with the Finder's
'computer' command - which goes all the way back to System 7.0 or earlier, I
think. Someone please correct me if I'm wrong. It pre-dates CarbonLib by a
long way. So all you have to do is stick it into a Finder tell block. If you
are compiling and saving it in OS X, it will compile as:

tell application "Finder"
system attribute "sysv"
end tell

It will run in OS 7 and 8 and 9, but if you open the script there, you'll
see:

tell application "Finder"
computer "sysv"
end tell
>
>> If so, is there a way that the script can detect which OS it is running on?
>>
>> My theoretical application would pop up a dialog box saying "You are running
>> system version x.xx"

I use the following,similar to what Rob offered, but a lot shorter. I've
added Dave's display dialog. If you are running OS X or late OS 9.1/2,
'computer' will compile to 'system attribute'.



display dialog "You are running system version " & GetSystemVersion()

to GetSystemVersion()

tell application "Finder" to set hexNum to computer "sysv"
set {a, X} to {hexNum div 4096, hexNum mod 4096}
set {b, y} to {X div 256, X mod 256}
set {c, d} to {y div 16, y mod 16}

if a  "0" then set b to "" & a & b
set OSvers to "" & b & "." & c & "." & d

return OSvers

end GetSystemVersion



--
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.

  • Follow-Ups:
    • Re: OS version questions
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: OS version questions (From: Nigel Garvey <email@hidden>)

  • Prev by Date: Re: Ethan's kneecaps
  • Next by Date: Re: Include "\" in do shell script command
  • Previous by thread: Re: OS version questions
  • Next by thread: Re: OS version questions
  • Index(es):
    • Date
    • Thread