iChatAutoLocationStatus

Update your iChat or Messages.app status automatically according to location

What iChatAutoLocationStatus Does

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.

System Requirements

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.

How to use iChatAutoLocationStatus

Three easy steps:

  1. Download and Install
  2. Customize
  3. Activate

1. Download and Install the Script

For 10.6, 10.7, 10.8 (Snow Leopard, Lion, Mountain Lion)

  1. Open iChat (or Messages.app) Preferences.
  2. Go to the “Alerts” tab.
  3. Select Event: “When I Log In”.
  4. From the “Run an AppleScript script” menu, select “Open Scripts Folder”.
  5. This will open your ~/Library/Scripts/iChat folder for you.
  6. Download “iChatAutoLocationStatus.applescript” and put it into this folder.

    Open ~/Library/Scripts/iChat folder

For 10.9 (Mavericks)

  1. Open Messages.app Preferences.
  2. Go to the “General” tab.
  3. From the “AppleScript handler” menu, select “Open Scripts Folder”.
  4. This will open your ~/Library/Application Scripts/com.apple.iChat folder for you.
  5. Download “iChatAutoLocationStatus.applescript” and put it into this folder.

    Open ~Open Scripts Folder

2. Customize the Script for your Locations

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.

3. Activate the Script

For 10.6, 10.7, 10.8 (Snow Leopard, Lion, Mountain Lion)

  1. Go back to iChat (or Messages.app) Preferences, which should still be on the “Alerts” tab, with Event: “When I Log In”.
  2. From the “Run an AppleScript script” menu select “iChatAutoLocationStatus.applescript”.

    Activate Script

For 10.9 (Mavericks)

  1. Go back to Messages.app Preferences, which should still be on the “General” tab.
  2. From the “AppleScript handler” menu select “iChatAutoLocationStatus.applescript”.

    Activate Script

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.


Page maintained by Stuart Cheshire