KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to detect the Intel-based Mac platform?
PRODUCT: 4D | VERSION: 2004.6r2 | PLATFORM: Mac OS X
Published On: May 9, 2007

The 4D command Gestalt will not allow the detection of an Intel-based Mac machine. Based on Apple's documentation this code:

$LongInt_errorCode := Gestalt ("sysa"; $LongInt_returnValue)

Should return a value of 10 on Intel-based Macs and a value of 2 on Power PC's. Instead it returns 2 regardless of the type of machine being run on. As a workaround to this problem the Applescript command system attribute "sysa" can be used to return the correct value. Here is a snippet of code using Applescript and LAUNCH EXTERNAL PROCESS:

C_TEXT($Out)
C_TEXT($In)

LAUNCH EXTERNAL PROCESS("osascript -e 'system attribute \"sysa\" '";$In;$Out)

The command will return a 10 on Intel Mac or a 2 on Power PC in the $Out text variable.

For more information on the LAUNCH EXTERNAL PROCESS and Gestalt commands see the 4D Online Documentation.

Gestalt:
http://www.4d.com/docs/CMU/CMU00488.HTM

LAUNCH EXTERNAL PROCESS:
http://www.4d.com/docs/CMU/CMU00811.HTM