Use A Bluetooth Device To Lock And Unlock Your Mac When You’re Near

Previously mentioned Mac utility Proximity is really handy for performing actions when a Bluetooth connection is made with your Mac and a compatible device. AppleScripter mech14 put together two scripts to use Proximity to lock and unlock your Mac when you’re near by, giving you an awesome Ubuntu-like security system.

Mech14 made the script so it also plays and pauses music when the Bluetooth connection is made, but that’s optional. To get it to work you just need to set his AppleScripts as the actions for Proximity. Here’s the one to unlock your machine:

–tell application “iTunes” to play
–This is optional; if you want to play music when you are in the proximity of your computer, it will play ur music. Just delete the 2 minus signs in front of ‘–tell application “iTunes” to play’

tell application “System Events”
tell security preferences
set require password to wake to false
end tell
end tell

tell application “ScreenSaverEngine” to quit

And the one to lock it:

–tell application “iTunes” to pause
–again, this is optional, but if iTunes is playing, you might want to pause it; delete ‘–‘

tell application “System Events”
tell security preferences
set require password to wake to true
end tell
end tell

— start screensaver (which locks the screen)
activate application “ScreenSaverEngine”

Both are downloadable here with a readme file, but check out the full post over on Mac OS X for detailed instructions and customisation options.

Lock and unlock a Mac using Bluetooth detection [Mac OS X Hints via @Cole_Morgan]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


3 responses to “Use A Bluetooth Device To Lock And Unlock Your Mac When You’re Near”

Leave a Reply