Hi Got this script for another forum to check airpods charge status, the script wud not compile
getAirPodsProBatteryLevel("One's AirPods Pro") -- change with your device name
on getAirPodsProBatteryLevel(deviceName)
set xmlData to do shell script "system_profiler SPBluetoothDataType -xml"
set theData to ((current application's NSString's stringWithString:xmlData)'s dataUsingEncoding:(current application's NSUTF8StringEncoding))
set infoDict to (current application's NSPropertyListSerialization's propertyListWithData:theData options:0 format:(missing value) |error|:(missing value))
set devlist to ((infoDict's firstObject()'s valueForKey:"_items")'s firstObject()'s valueForKey:"device_connected")
if devlist ≠ missing value then
repeat with j from 0 to (count of (devlist as list)) - 1
if (devlist's objectAtIndex:j)'s allKeys()'s firstObject() as text = deviceName then
set devDic to ((devlist's objectAtIndex:j)'s valueForKey:deviceName)
set BatteryCase to (devDic's valueForKey:"device_batteryLevelCase") as string
set BatteryLeft to (devDic's valueForKey:"device_batteryLevelLeft") as string
set BatteryRight to (devDic's valueForKey:"device_batteryLevelRight") as string
return {BatteryCase:BatteryCase, BatteryLeft:BatteryLeft, BatteryRight:BatteryRight}
end if
end repeat
end if
end getAirPodsProBatteryLevel