21 Comments

Summary:

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)! […]

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.

Proximity_desklock

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.

You’re subscribed! If you like, you can update your settings

  1. The best post ever!!!! Thank you very much.

  2. I tried this 2 years ago with Proximity but found it very unreliable.

  3. Bryan Schuetz Thursday, June 11, 2009

    @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.

  4. Check out Marco Polo. http://www.symonds.id.au/marcopolo/ 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.

  5. How are you able to pair your iphone and mac? My macbook/iphone won’t find each other…

  6. Is there a PC equivalent? Yes, I know this is The Apple Blog. But I use a PC at work and a Mac at home.

  7. How-To: Proximity Automation » Shai Perednik.com Thursday, June 11, 2009

    [...] theappleblog.com Related [...]

  8. 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. :)

  9. Bryan Schuetz Thursday, June 11, 2009

    @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 http://www.phoenixfreeze.com/

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

  10. 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”…

Comments have been disabled for this post