Detect battery percentage applescript How would I detect what my computer's battery percentage is using applescript? All answers to similar questions say to install additional software, but I would like to do this with purely applescript. Is this possible? I've also tried searching through the  applescript library with no success.
Here is an example of setting the percent charged of the internal battery to a variable using AppleScript.

In the sample code below the batteryPercent variable holds the numeric percentage of battery charge and is shown in a message.

set batteryPercent to do shell script "pmset -g batt | awk '/InternalBattery/ { sub(/;/, \"\"); print $2 }'"

display dialog "Battery is " &amp; batteryPercent &amp; " charged." buttons {"OK"} default button "OK"