Every-so-often a utility is written for one use, and a whole new one springs up that can take advantage of it.
Proximity is one such utility, which was written to perform a given action when a Bluetooth connection is established by a Mac and a compatible device.
Uses such as launching iTunes when a pair of Bluetooth headphones are detected immediately sprint to mind with Proximity, but now there’s a new use – locking and unlocking your Mac.
According to Lifehacker, Apple scripter Mech14 decided to leverage the power of Proximity to enable users to lock, and indeed unlock their computers when a Bluetooth phone is nearby. It’s a cool security feature, and one that shows off a new and interesting way of getting around the inane entering of passwords over and over again, each time you need to go for another coffee!
The two sets of AppleScript you need are thus:
For unlocking your Mac:
–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 your 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 telltell application "ScreenSaverEngine" to quit
…and 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"
The scripts currently pause and un-pause music during the locking and unlocking process, but those lines can be removed should you wish.
Both sets of AppleScript can be downloaded from here, along with a useful README file.
Fun and functional, and we like it a lot!
You can follow us on Twitter or join our Facebook fanpage to keep yourself updated on all the latest from Microsoft, Google and Apple.