Update I should note I only partially sorted out getting this to actually work. Probably requires more tinkering and may be best to just go get an app that does the lock/unlock for you.
This procedure is roughly based on Lock Your Mac When Your iPhone Is Out of Range. I’d seen this in the past, but never got around to figuring out how to set it up. Since I’ve got an iPhone with good battery life, leaving Bluetooth on isn’t as scary as it was on my old Android phone, so I thought I’d give it a shot.
I’ve gone the extra steps of figuring out how to retrieve your password from Keychain in order to do the unlock. The sample unlock AppleScript in that post suggests storing your Mac account password in plain text in the script (not so great) and offers that you can save your script as “Run-only” to obfuscate it. I tried that for kicks and while the script itself is obfuscated, your plain text password is still there if you just cat the file.
My foray into the world of Android phones is finally at an end, and am now the owner of a shiny iPhone 4S. It was an interesting experiment, and there were a few features that I will miss that I haven’t found a way to do on the iPhone, but the Android experience finally got bad enough (and I hit my 2 year contract anniversary) to push for a phone upgrade at work. There were just too many issues with my Droid and Android in general from a usability standpoint to suffer it any further. Issues with the Android ecosystem (at least as I’ve been able to experience it… maybe 4.0 will really start to address some of their problems):