Script to Output Magic Trackpad and Keyboard Battery?


Im looking for a script that output battery of the devices as a percentage. I have a script, but im using rechargeable NiMH batteries so it does not show the right percentage. Does anyone have a script that gets the percentage from bluetooth setting where it is displayed correctly?

Many Thanks


this is for the trackpad, for the other devices use the respective BNB. specifier

do shell script "ioreg -c BNBTrackpadDevice | awk '/\"BatteryPercent\" =/ {print $NF}'"

Hi, Thanks again, do you know the BNB for just the trackpad? total noob here

I don’t have the keyboard, so it’s not displayed in IOReg, for the mouse it’s BNBMouseDevice.
I recommend to google for bluetooth Keyboard battery level terminal