• 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: Installer script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installer script


  • Subject: Re: Installer script
  • From: Kai Edwards <email@hidden>
  • Date: Mon, 02 Sep 2002 04:45:57 +0000

on Sun, 1 Sep 2002 16:35:58 +0200, Harald E Brandt <email@hidden> wrote:

> +--> JJ wrote 02-09-01:
>> (alias (path to system folder) as text) & "System"
>> short version of (info for result)
>> --> i. e., "E1-9.2.2"
>>
>>
>> tell application "Finder"
>> set sysv to computer "sysv" -- or system attribute "sysv"
>> end tell
>> set majorversion to sysv div 256
>> --> i.e., 9
>> set minorversion to (sysv mod 256) div 16
>> --> i.e., 2
> +-
>
> Great, except it gives wrong result for OS 10, requiring a minor fix.
> This works fine for all:
>
> tell application "Finder" to set sysv to system attribute "sysv"
> set majorversion to sysv div 4096 & (sysv mod 4096) div 256 as string
> as integer
> set minorversion to (sysv mod 256) div 16
> set subminorversion to (sysv mod 16)
>
> if subminorversion > 0 then
> "" & majorversion & "." & minorversion & "." & subminorversion
> else
> "" & majorversion & "." & minorversion
> end if
> set OSversion to "System version: " & result
>
> if majorversion > 9 then
> alias ((path to system folder as text) & "system")
> short version of (info for result)
> set OSversion to OSversion & return & "Classic version: " & result
> end if
> display dialog OSversion

FWIW, this variation calculates the system version as a number (X.XX rather
than X.X.X - when the trailing digits are not zeros):

---------------------------------------------------------------
tell application "Finder" to set {x, y} to {0, computer "sysv"}
repeat with n from 3 to 0 by -1
set {x, y} to {x + (y div (16 ^ n)) * (0.1 ^ -(n - 2)), y mod (16 ^ n)}
end repeat
display dialog "Mac OS Version: " & x
---------------------------------------------------------------

Not tested exhaustively - but seems to work OK on a couple of my machines.

Best wishes.

Kai

--
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: wierdness: colons stripted from alliases when script saved as classic app
  • Next by Date: Naming Files from List Ref
  • Previous by thread: Re: Installer script
  • Next by thread: Re: Installer script
  • Index(es):
    • Date
    • Thread