How can I run a script when the room brightness has changed?

How can I run a script when the room brightness has changed? In particular I want to run a script when the lights have been turned off in the room that my Macbook is in.


ControlPlane provides a method of using the Ambient Light Sensor to determin a "location" then the location determines what changes on your computer. While ControlPlane is usually used to change system settings depending on where the computer is located, it could also be used to launch an application (or AppleScript) upon sensing a change in lighting.


Lilt will do this.

http://www.jonn8.com/lilt/

I used to use it to change my desktop picture from a light to dark one when the ambient light changed :D