• 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
System version as number (on non-US systems)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

System version as number (on non-US systems)


  • Subject: System version as number (on non-US systems)
  • From: Brennan <email@hidden>
  • Date: Wed, 11 Sep 2002 21:17:17 +0200

I'm sure this has been up before, sorry if it's a FAQ.

On my International English MacOS9, (version of application "Finder") is returning "Z1-9.1"
("Z" is the code for International English, in case people didn't know this).

I also notice that 'product version' on OSX returns an empty string. (Er...) This is supposed to be the OS version, as distinct from the Finder version - which is splitting hairs, but I am sure people would prefer to target the OS, rather than the Finder.

This makes me wonder whether we have to apply complicated heuristics to know whether it's a non-US OS9 (or less) or OSX.

Here's my idea: Can I strip everything up to and including a hyphen character - if one exists - and then coerce to number? Would that work with all PPC Mac systems?

The code I have to do this is as follows:

tell application "Finder"
set vString to (version of application "Finder")

try
set v to vString as number
on error msg number n

if n is -1700 then -- can't coerce vString to number

set o to (offset of "-" in vString) + 1
set AppleScript's text item delimiters to ""
set vString to ((characters o thru end of vString) as string)
set v to vString as number

else
error number n
end if

end try
return v

end tell


Isn't this outrageously complicated? Surely there's a better way to do this?

On OSX, I'm getting "10.1.2" because (of course) it's an international OS, so does not require a language code in the version, but does this really help? Can I rely on this?

Isn't there some way of getting these values reliably as numbers? Is there another reliable way of knowing whether it's OSX or an earlier Mac system?

Thanks in advance.

Brennan
_______________________________________________
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.

  • Follow-Ups:
    • Re: System version as number (on non-US systems)
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Folder Action Vs Finder
  • Next by Date: Re: Folder Action Vs Finder
  • Previous by thread: Re: JavaScript as "system-level library"
  • Next by thread: Re: System version as number (on non-US systems)
  • Index(es):
    • Date
    • Thread