enable/disable screen saver/computer sleep?
In a cocoa-application I am making, I would like to create buttons to enable and disable the computer from going to sleep. The following code is not working:
on disableSleep_(applescript)
do shell script"caffeinate &> /dev/null & echo $!"
end disableSleep_
on enableSleep_(applescript)
do shell script"kill -INT " & thePID
end enableSleep_
any suggestions?
MacBook Pro, OS X Mountain Lion (10.8.2), 2.3 GHz i5, 4GB RAM, OCZ 120GB SSD