Update your iChat or Messages.app status automatically according to location
iChatAutoLocationStatus sets your iChat or Messages.app status automatically, according to your network connectivity, which it uses as an indicator of your physical location.
It uses the IP address and/or the MAC (aka Ethernet) address of your current default gateway as a “fingerprint” to identify the network to which you are connected.
With the prevalence of NAT gateways these days you may connect to many networks where the default gateway is IP address 192.168.0.1, so the IP address alone is not always enough to tell you where you are, but adding in the MAC address as well makes it reliably unique. (If you find different networks where both the IP address and MAC address are the same then something is seriously wrong.)
Using this IP address and MAC address, the script matches a table you provide, to determine the iChat status message to set.
iChatAutoLocationStatus works with iChat on Mac OS X 10.6 (Snow Leopard) and 10.7 (Lion), and with Messages.app on Mac OS X 10.8 (Mountain Lion) and later.
Three easy steps:
For 10.6, 10.7, 10.8 (Snow Leopard, Lion, Mountain Lion)
For 10.9 (Mavericks)
Double-click the “iChatAutoLocationStatus.applescript” file you just put into your scripts folder, to open it in AppleScript Editor.
As provided, the script says:
if NetworkFingerprint contains "IPv4.Router=17.12.34.56" then set NewLocation to "At Apple" else if NetworkFingerprint contains "IPv4.Router=10.0.1.1;IPv4.RouterHardwareAddress=00:1f:xx:xx:xx:xx" then set NewLocation to "At home" else if NetworkFingerprint contains "IPv4.Router=192.168.99.1;IPv4.RouterHardwareAddress=00:16:xx:xx:xx:xx" then set NewLocation to "Somewhere else" end if
You need to modify this table to list your own fingerprints and corresponding status messages.
To discover suitable network fingerprint strings to use, open a Terminal window and enter the following command:
echo show State:/Network/Service/.\*/IPv\[46\] pattern | scutil | grep NetworkSignature
In the output you’ll see the network fingerprint(s) for the network(s) you’re currently on. You can choose to make the script match on:
Once you’ve made your changes, save your updated script.
For 10.6, 10.7, 10.8 (Snow Leopard, Lion, Mountain Lion)
For 10.9 (Mavericks)
Now, every time you change location, and wake your laptop on a new network and log in to iChat or Messages.app, it will then run the “login finished” event handler in the script. If you’re on a network the script recognizes, it will tell iChat or Messages.app to set the corresponding status message.
As you use your computer in the various different locations you habitually visit, you may want to run the scutil command again at each location to get new fingerprint strings to add to your script.
Also, if the network operator replaces hardware so that the MAC address changes, then your script may no longer recognize the location, so if you find that your script is no longer recognizing a location you visist, re-run the scutil command and see if the gatway MAC address has changed.