Copy/Paste the following AppleScript that I wrote back in 2013 into the AppleScript Editor, and click the hammer toolbar icon. Then run it and listen.
This script can be adapted to your value for a low battery announcement.
Code:
(*
Speakable items addition that recites current battery info.
Open in AppleScript Editor and Save As… script without extension
into login directory/Library/Speech/Speakable Items folder.
Name suggestion: Battery level.
Works exactly as coded. Though intended for visually challenged, it will
output a text banner containing the speech content if audio is off.
Tested on OS X 10.7.5, 10.9.5, and 10.10.3
VikingOSX, December 2013, Apple Support Community
Version 1.2
*)
set theList to {}
set thePct to ""
set theHr to ""
set theMin to ""
set expression to ""
set theList to paragraphs of text of (do shell script "pmset -g batt")
set itemCnt to count of items in theList
if (itemCnt = 1) then
say "Desktop Device not equipped with battery."
return
end if
set thePct to word 3 of theList's item 2
if theList's item 2 contains "finishing charge" then
set theHr to word 6 of theList's item 2
set theMin to word 7 of theList's item 2
else
set theHr to word 5 of theList's item 2
set theMin to word 6 of theList's item 2
end if
--display dialog thePct & return & theHr & return & theMin
--trim leading zero
if (theMin begins with "0") then set theMin to text 2 thru -1 of theMin
if theList's item 1 contains "AC Power" then
set powerStatus to "power cord"
set chargeStatus to "full charge."
else
set powerStatus to "battery power"
set chargeStatus to "battery exhaustion."
end if
if (thePct is greater than or equal to "99") then
set expression to "Currently on " & powerStatus & " at full charge."
else if (theHr is "0") and (theMin is not "0") then
set expression to "Currently on " & powerStatus & ¬
" with the battery at " & thePct & ¬
" percent, and " & theMin & " minutes to " & chargeStatus
else if (theHr is "1") and (theMin is greater than or equal to "0") then
set expression to "Currently on " & powerStatus & ¬
" with the battery at " & thePct & ¬
"percent , and " & theHr & ¬
" hour, and " & theMin & " minutes to " & chargeStatus
else
set expression to "Currently on " & powerStatus & ¬
" with the battery at " & thePct & ¬
"percent , and " & theHr & ¬
" hours, and " & theMin & " minutes to " & chargeStatus
end if
sayexpression