How to programatically get current battery level with COCOA [duplicate]
-
06-07-2019 - |
Question
This question already has an answer here:
- Battery status in OSX? 3 answers
How can I get the current battery level using the cocoa framework running with Leopard?
Currently I am getting it running a NSTask with:
pmset -g ps | grep -o -e [0-9]*% | sed -e 's/%//g'
But i think this is a clumsy way of doing this.
Thanks
Solution
I believe this question has been asked here before... Here's some links:
Battery status in OSX? (asked here before)
It limited my number of links because I'm new... but you should find more links there
OTHER TIPS
Take a look at: http://forums.macrumors.com/showthread.php?t=474628
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow