I'm running OS 10.7.5 on an October 2008 unibody MacBook, and I would like to somehow get my computer to run a script whenever I press the power button, instead of prompting me if I want to turn my laptop off. My situation is as follows: simply closing the cover of the MacBook sometimes results in Sleep mode not initiating, and the computer then closed gets very hot (not sure what's going on in there). I solved this problem by pressing the Power button and choosing "Sleep" each time I want to put it to sleep, and then closing the lid. Now, as I use TrueCrypt, I want to unmount all my TrueCrypt drives whenever I put my laptop to sleep. So when I press the power button, I wish to run the following commands: truecrypt -d osascript -e 'tell application "System Events" to sleep' In this case it doesn't have to give me any type of prompt, I would like the commands to be executed directly. Any suggestions appreciated!