Re: applescript to get system version
Re: applescript to get system version
- Subject: Re: applescript to get system version
- From: Nigel Garvey <email@hidden>
- Date: Tue, 16 Mar 2004 09:49:32 +0000
Graff wrote on Mon, 15 Mar 2004 23:32:43 -0500:
>
On Mar 15, 2004, at 3:45 PM, Martha Espinosa wrote:
>
>
> Does anyone know how I can get the OS version a user is currently
>
> running?
>
Snipped from this Apple web page:
>
<http://www.apple.com/applescript/uiscripting/01.html>
>
-----------
>
set the hexData to system attribute "sysv"
>
set hexString to {}
>
repeat 4 times
>
set hexString to ((hexData mod 16) as string) & hexString
>
set hexData to hexData div 16
>
end repeat
>
set the OS_version to the hexString as string
>
-----------
It's one of the more unbelievable aspects of AppleScript that the method
for getting the system version depends on the system version. In OS X,
it's:
set the hexData to system attribute "sysv"
Otherwise, it's:
tell application "Finder"
set the hexData to computer "sysv"
end tell
... though both work in OS 9.2.2.
Fortunately, as Paul B. pointed out to me some time ago, the same event
code is involved in each case, so if you use both a Finder 'tell' block
and the command that goes with the system on which the script's compiled,
it'll work on any system (so far). If compiling in X:
tell app "Finder"
set the hexData to system attribute "sysv"
end
It's another unbelievable aspect of AppleScript that Apple's own routines
seem to go out of their way to be as inefficient as possible....
NG
_______________________________________________
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.