This is a legacy guide for Power Manager v4, published 2010 – 2019, and is provided for reference only.
The latest guide is for Power Manager v5.10.6.

Scripting the Battery and Power

Example 9.1. Listing Battery and Power Sources

Get the current list of battery and power sources.

tell application "Power Manager"
    set mySources to every power source in Power
end tell

Example 9.2. Checking for a Power Source

Determine if a battery or power source is connected. Power sources include internal and external batteries, and uninterruptible power supplies.

tell application "Power Manager"
    if every power source in Power is {} then
        -- There are no batteries or power supplies
    else
        -- There is at least one battery or power supply connected
    end if
end tell