How can I get MAC address of current base station?
Hi,
do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ BSSID: / {print $2}'"
Doesn’t work on my G5, Stefan. However these do:
set MAC to primary Ethernet address of (get system info)
set B to button returned of (display dialog "Your MAC address is: " & MAC buttons {"To Clipboard as is", "No Colons -> Clip", "Done"} default button 3)
if B is "To Clipboard as is" then
set the clipboard to MAC
else if B is "No Colons -> Clip" then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set MAC to (text items of MAC)
set AppleScript's text item delimiters to tid
set the clipboard to MAC as text
end if
set MACaddr to primary Ethernet address of (system info)
set MAC_1 to do shell script "ifconfig en0 | grep ether | cut -c 8-24"
set MAC_2 to do shell script "ifconfig en1 | grep ether | cut -c 8-24"
set airport_MAC_add to do shell script "ifconfig en1 | grep ether | cut -c 8-24"
return {ethernet_MAC_add_1:MAC_1, ethernet_MAC_add_2:MAC_2, airport_MAC_add:airport_MAC_add}
You’re fetching the MAC address for the machine’s various parts, not the base station that was requested. (Though it works for what it’s supposed to do.)
Stefan’s script works for me…
Edit: This also works for me:
do shell script "/usr/sbin/netstat -rf inet | /usr/bin/grep '^home ' | /usr/bin/awk '{print $2}'"