Re: OS version questions
Re: OS version questions
- Subject: Re: OS version questions
- From: Rob Jorgensen <email@hidden>
- Date: Fri, 18 Jul 2003 14:31:53 -0400
At 10:16 AM -0700 7/18/03, Dave Miller wrote:
Can anyone tell me if it is possible to have a single script run as a
stand-alone application on OS 8.x, 9.x and OS X?
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"
This appears to work on OS 9 and X (no 8 to test
with). It was compiled on OS X and saved as a
non-classic application. It's not my code and
unfortunately I don't know who to credit. Watch
for list butchering of the continuation character
- it shows up as a comma in Eudora.
-- begin --
copy my gestaltVersion_info("sysv", 4) to {system_version, system_string}
display dialog "You are running system version " & system_string
on gestaltVersion_info(gestalt_code, string_length)
try
tell application "Finder" to ,
copy my NumToHex((system attribute gestalt_code), ,
string_length) to {a, b, c, d}
set the numeric_version to {a, b, c, d} as string
if a is "0" then set a to ""
set the version_string to (a & b & "." & c & "." & d) as string
return {numeric_version, version_string}
on error
return {"", "unknown"}
end try
end gestaltVersion_info
on NumToHex(hexData, stringLength)
set hexString to {}
repeat with i from stringLength to 1 by -1
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
return (hexString as string)
end NumToHex
-- end --
--
Rob Jorgensen
Ohio, USA
_______________________________________________
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.