Tech Tip: How to get the MAC address
PRODUCT: 4D | VERSION: 11.5 | PLATFORM: Mac & Win
Published On: December 3, 2009
The Media Access Control address (MAC address) is a networking term that refers to the unique identifier assigned to network adapters or Network Interface Cards. Among other things, a MAC address allows computers to uniquely identify themselves on a network. So it is useful to have this information, especially for networking purposes.
You can obtain the MAC address using the LAUNCH EXTERNAL PROCESS command and certain Unix/MS-DOS commands. You will need to parse through the results though, as each Unix/MS-DOS command returns the MAC address differently.
Here is a simple method designed to find and return the MAC address for Windows OS or Mac OS:
C_LONGINT($OS) C_TEXT($macAddress;$cmd;$input;$output;$error) PLATFORM PROPERTIES($OS) If ($OS=Mac OS ) $cmd:="system_profiler SPHardwareDataType" LAUNCH EXTERNAL PROCESS($cmd;$input;$output;$error) $macAddress:=Substring($output;Position("Serial Number:";$output)+14;12) Else $cmd:="ipconfig /all" LAUNCH EXTERNAL PROCESS($cmd;$input;$output;$error) $macAddress:=Substring($output;Position("Physical Address";$output)+36;17) End if ALERT("Your MAC address is "+$macAddress) |
$cmd:="ifconfig en0"
LAUNCH EXTERNAL PROCESS($cmd;$input;$output;$error)
$macAddress:=Substring($output;Position("en0";$output)+77;17)