• 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: Mac OS Version Sniffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mac OS Version Sniffer


  • Subject: Re: Mac OS Version Sniffer
  • From: Kai Edwards <email@hidden>
  • Date: Wed, 23 Oct 2002 00:33:39 +0000

on Tue, 22 Oct 2002 10:46:00 +0200, Brennan <email@hidden> wrote:

(snip)

> ...but Kai Edwards sent me a script for Applescript 1.6 or later which uses
> the actual System version, rather than the Finder version.
>
> try
> tell application "Finder" to set {x, y} to {"", computer "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 & [NO BREAK]
> "." & it's character -2 & "." & it's character -1
> display dialog "Mac OS " & x & "." -- test

Actually, the script isn't just limited to AS 1.6 (circa OS 9.1) or later.
It should also work for much earlier versions. At present, I can only test
back as far as AS 1.1.2 (OS 8.0), but it certainly works for me there, too.

As I understand it, AS 1.6 is a special case because of an apparent hiatus
between previous OS versions and the Classic environment of Mac OS 10.0.

In previous versions, the Gestalt Selector (raw code <<event fndrgstl>>) is
handled by the Finder and compiles (in a Finder tell block) as 'computer'.
With the advent of OS X, the job was passed to Standard Additions - where
the same raw code now compiles (without a tell block) as 'system attribute'.

The good news is that the command still works within a Finder tell block -
so it can be used in this 'cloak' to cover a range of OS versions. :-)

The bad news is that the command evidently fell through the cracks during
the changeover - so that neither the Finder's 'computer' nor Standard
Additions' 'system attribute' will work in the *Classic* environment of OS
10.0. :-(

In this situation, any attempt to send the event returns an error number
-1708 (the AppleEvent was not handled by any handler) - hence the error trap
above (4096 --> "10.0.0").

I hope that clarifies the scope of the script (and the reasons for the trap)
a little better.

Kai

(- whose spellchecker insists that "AppleEvent" should be "appellant".)

----------------------------

For further information, see Bill Cheeseman's AppleScript Sourcebook at:
http://www.AppleScriptSourcebook.com

--
email@hidden
email@hidden
_______________________________________________
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.

  • Prev by Date: Re: User Name in OS X +
  • Next by Date: Apple Script for Multiple attachments to Outlook Express from FileMaker
  • Previous by thread: Re: Mac OS Version Sniffer
  • Next by thread: AppleWorks 6
  • Index(es):
    • Date
    • Thread