Tech Tip: Using PLATFORM PROPERTIES to get Mac OS version
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: August 27, 2009
The PLATFORM PROPERTIES command returns the system version in parameter 2, as a long integer. For Mac OS the high byte is used as the major version and the low byte is separated in to two 4 bit "nibbles" which contain the major and minor update version. The following code uses bitwise operators to translate the Hex value into a string:
C_LONGINT($platform;$system) C_TEXT($version) PLATFORM PROPERTIES($platform;$system) If ($platform = Mac OS) $version:=String(Num(String($system >> 8;"&X")))+"." $version:=$version+String($system & 0x00F0 >> 4)+"."+String($system & 0x000F) End if |
This code will return the version as a string. For example, if run on Mac OS X 10.5.8, at the end of the code snippet, $system would be 4184 decimal (1058 hex) and $version would have the translated value, "10.5.8".