Scripting with battery info - or other options
Is there a way to enable this feature, or do I need to write a script?
If I have to write a script, I have figured out basically how to do it. I just have one question. How can my script determine the battery level? I want to have a launchd task check the battery every few minutes. If it gets too low, it will execute a command line program called deepsleep which will write the RAM to disk and shut down the system. The script can be in bash or Applescript, which ever is easier to determine the battery level with.
I have looked all over the IORegistry with no success. Am I missing something? Has apm been ported from Linux to Mac? I know that would do what I want.
Macbook Core Duo, Mac OS X (10.4.8), 2GB RAM, 120GB HD, SD