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.


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

  11. Usa el Bluetooth para bloquear tu mac si te alejas. @ El blog de ellow Friday, June 12, 2009

    [...] Visto en theAppleBlog [...]

  12. 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?

  13. (In the preference pane of proximity the iPhone will not show up, despite the iPhone bluetooth being on and discoverable)

  14. iFUN.de/iPhone :: Alles zum iPhone − Video: iPhone in der Nähe? Rechner automatisieren! Friday, June 12, 2009

    [...] von diesem TAB-Artikel haben wir uns heute Nachmittag etwas ausführlicher mit der hier verfügbaren, kostenlosen [...]

  15. What do I write in the AppleScript if I want it to turn on/off my monitor?

  16. Elsewhere, on June 14th – Once a nomad, always a nomad Saturday, June 13, 2009

    [...] How-To: Proximity Automation — 12:13pm via [...]

  17. Aprovecha el BlueTooth de tu Mac. Cómo hacer un sensor de proximidad automático. | Applediario Monday, June 15, 2009

    [...] Fuente ¿Valorarías esta nota?  Loading … Compártelo Imprimir Tags: Bluetooth, Guias, Macs, Software, Trucos « Así construye Apple sus nuevas baterías Inicio [...]

  18. It would be nice if you had the option of using this with iChat instead of Adium.

  19. links for 2009-06-26 at So It’s Come To This: Friday, June 26, 2009

    [...] How-To: Proximity Automation (tags: howto hacks mac apple security automator remote) [...]

  20. appleblog roundup Sunday, June 28, 2009

    [...] Proximity Automation: Proximity is a cool free application that monitors your BlueTooth device and fires off AppleScripts as it moves in and out of range. I whipped up a couple of scripts to pause iTunes, set your away message in Adium and lock your screen just by getting up and walking away. And of course it reverses all that once you get back. [...]

  21. Hey here is a proximity reader for unlocking you door & gate as well as your PC, http://www.eckey.com

Comments have been disabled for this post