Henrik speaking at a conference

Hi, I’m Henrik Joreteg

Mobile web consultant, developer, and speaker

posts | twitter | email | hire | book | my startup: Xchart.com

How to magically run stuff when you're near your Mac... or not


or not" old_url: http://joreteg.com/post/918116737/magically-run-stuff-when-near-mac-or-not ...

What you need

  • A Mac

  • Some type of bluetooth device you always have with you (let’s get real, if you’ve got a mac you’re using an iPhone)
  • Step 1.

    Download and install Proximity:

    proximity download screenshot

    Step 2.

    Open AppleScript editor and create a script to run when you’re near your computer. Mine is super simple. It just turns off the screen saver and sets my chat status in “Adium” (if it’s running) to available. But obviously you could do anything you can do in AppleScript. Mine looks something like this:


    tell application "ScreenSaverEngine" to quit

    if appIsRunning("Adium") then tell application "Adium" to go available end if

    on appIsRunning(appName) tell application "System Events" to (name of processes) contains appName end appIsRunning


    And create another one for when you’re away. Once again mine’s super simple:


    tell application "ScreenSaverEngine" to activate

    if appIsRunning("Adium") then tell application "Adium" to go away with message "Appears to have stepped away for a bit." end if

    on appIsRunning(appName) tell application "System Events" to (name of processes) contains appName end appIsRunning


    I saved these two scripts in a “Scripts” folder I created in my home directory (fancy that!).

    Step 3.

    Now all you have to do is give tell Proximity which script to run when and which bluetooth device you want it to look for. If Proximity is running you’ll see a small (somewhat ugly) bluetooth lookin’ icon in your toolbar. Click it to open preferences. My preferences look like this:

    proximity preferences

    Step 4.

    Tell @HenrikJoreteg on twitter that it worked for you and that you’d give him a high-five if you were within reasonable high-five range.