Automatically taking a photo every time your computer wakes up

Like it says on the tin:

(download)

I'm taking several pictures of myself each day without any effort. It's a lazy photo diary that I don't have to devote any time to maintaining.

I recently came across a post on this subject, but the author didn't include the scripts he used in his implementation. I wrote my own. You'll need:

  • OSX 10.5 or later
  • nonzero familiarity with Terminal.app
  • sleepwatcher, a free command-line daemon that monitors sleep, wake, and idle states

With sleepwatcher installed, it's just a matter of connecting it to a photo script. I used Automator.app to create a workflow (with camera flash or without) that launches Photo Booth.app and takes a photo.

Photo Booth works well here — more so than invisibly taking a photo in the background, perhaps — because it counts down from 3 before capturing, giving you time to pose, and because it remains open afterwards for re-takes. Photo Booth won't be much help recovering your laptop from a thief, but there is an app called iTried that purports to be more subtle.

With your Automator workflow in place, run this command in Terminal and point it at your photo workflow. I saved mine in Dropbox for easy access anywhere.

/usr/local/sbin/sleepwatcher -d -w "exec automator ~/Dropbox/Documents/TakePhoto.workflow"

This command will need to be run once every time your computer starts up. For bonus points (or a future update?) you can add a launchd script that will start it automatically on login.

Follow jhersh on Twitter