Blog Post

How-To: Proximity Automation

Stay on Top of Enterprise Technology Trends

Get updates impacting your industry from our GigaOm Research Community
Join the Community!

Proximity application icon

Would you like to be able to use the magic of Bluetooth to automatically pause iTunes, set your away message in Adium, and lock the screen simply by standing up and walking away from your desk? Of course you would — it’s future-tastic (jetpacks not included)! Let’s take a look at how to pull this off.

What You’ll Need

First you’ll need a copy of Proximity, a handy (and free) little application which monitors your Bluetooth-enabled device and fires off AppleScripts when it leaves and enters connection range. As an added touch, we’ll also use a copy of DeskShade to lock and unlock the computer with style, leaving a nice away message displayed on the screen and opening a “Hacker Log” to display what activity took place while you were away.

DeskShade actually does a lot more than just allow AppleScript to lock and unlock your screen. I won’t go into a full review of it here, but essentially, it will also help keep your desktop clean, your wallpaper fresh, and your mind uncluttered. If, however, you want to forgo the use of DeskShade, you can instead lock and unlock the computer by having AppleScript launch your screensaver and adjust the security settings required for waking it up. AppleScript files for both approaches can be downloaded here (8kb, ZIP).

Screenshot of the scripts used in this tutorial

Getting Set Up

Install Proximity, and from within the preferences pane select your Bluetooth device. I used my iPhone, but any “discoverable” device should work. In the AppleScript section link to OutofRange.scpt for when the device moves out of range and InRange.scpt for when it moves back in range. Make sure that monitoring is enabled and set a frequency for proximity checks — I used 60 seconds. If you decided not to go the DeskShade route, then just swap in the second set of scripts for that step above and skip ahead to the testing.

Install DeskShade and on the DeskLock tab set a password, enable AppleScript to unlock, set the Hacker Log to open after unlocking and set the away message to something appropriate. I used the same “More than 30ft away from my computer” message that is set in Adium via the out-of-range script.


Future Perfect

It’s as simple as that. Get up and take a walk around to test it out; by the time you get back, your computer should be unlocked, and you can have a look at the Hacker Log to see what happened while you were gone. Now all we need are jetpacks, flying cars, and a reliable way to prevent “sock-loss” when doing the laundry, and it will be future perfect.

21 Responses to “How-To: Proximity Automation”

  1. Andrew

    Back @ Bryan

    I already tried to do that, I have my MacBook on Bluetooth, Discoverable, and turned on Bluetooth on my iPhone, and still they do not seem to be finding each other….?

    Any ideas?

  2. Is there any way to get the song currently playing on your iphone/ipod touch to start playing (at the same point in the duration) as you are walking in the door? That would be pretty “Future House”…

  3. Bryan Schuetz

    @Andrew once you turn on Bluetooth for your iPhone (under settings -> general) you should see it in the list of Bluetooth devices from within the preference pane in proximity.

    @Skube A quick search turned up this alternative for PCs

    @David Yeah, you could do that and it would be more secure. But, it wouldn’t be as cool :)

  4. Obviously, this isn’t the most secure thing in the world — you leave your iPhone on the receptionist’s desk after sending a fax on your way out to lunch, and anyone can get onto your computer.

    I might suggest that you tweak the “return” functionality so that it still requires a password to unlock the computer, but can still resume the music, turn the monitor back on (by this time it’ll be in powersave mode), and so forth. This way, by the time you’ve actually sat down in front of the computer, it’s ready for you to unlock. I’d bet you could even script it to pull up the screensaver password panel and give it focus, so that it’s walk in, turn on the lights, sit down, and type, no mouse-jiggling or other wake-up actions necessary.

    Now if I could just figure out a way to do this without BT. :)

  5. Check out Marco Polo. I’ve been using it for quite some time and you can check for a lot of things in addition to Bluetooth proximity. Been using it for a while and like it alot. Mainly I use it to detect whether I’m at work or home and it maps shared drives and default printers based on where I am.

  6. Bryan Schuetz

    @mopac01 I had some trouble with the earlier version but they just released version 1.5 a couple days ago and I find it a lot more stable.