Re: X, Classic, or 9?
Re: X, Classic, or 9?
- Subject: Re: X, Classic, or 9?
- From: Nigel Garvey <email@hidden>
- Date: Mon, 17 Jan 2005 14:07:49 +0000
Gil Dawson wrote on Sun, 16 Jan 2005 13:51:42 -0800:
>At 5:04 PM -0800 1/13/05, Gil Dawson wrote:
>>Can you think ofsomething to test at the beginning of the script to
>>tell which environment it is running in, so I'll need to keep only
>>one consolidated version?
>
>At 9:28 AM +0100 1/14/05, yvan-koenig wrote:
>>...«event fndrgstl» "sysv"...
>
>At 11:36 AM -0800 1/14/05, Gil Dawson wrote:
>>This works in all three of my environments...
>
>It does work, in the sense that the code compiles in all three environments.
>
>However, system attribute "sysv" yields hex 0922 when the script is
>running in Classic (under 10.3.7) and also hex 0922 when the script
>is running in a computer booted with MacOS 9.2.2. It's the same
>number in both cases.
>
>I need an AppleScript code snippet that can discriminate among
>whether that script is running under X, under Classic, or in a
>computer booted with 9.2.2.
This works in Jaguar, Jaguar/Classic, OS 9.2.2, and OS 8.6:
tell application "Finder" to set FinderSysv to («event fndrgstl» "sysv")
if FinderSysv < 4096 then
-- Some version of Mac OS prior to OS X
else if FinderSysv > («event fndrgstl» "sysv") then
-- Classic
else
-- OS X
end if
The idea is that the currently running Finder returns the system version
of its own environment. If this is 10.0 or greater, the script's running
environment is then tested. An alternative would be to get the first
character of the Finder's version as string. If this is "1", it's
somewhere between OS 10 and OS 19.
«event fndrgstl» was originally the Finder's 'computer' command, but was
later added to the Standard Additions and became 'system attribute'.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden