Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set Cap to (do shell script "ioreg -w0 -l | grep ExternalChargeCapable")
  2. tell Cap to set {wallPower} to {last word of paragraph 1}
  3.  
  4. if wallPower = "Yes" then
  5.         return 0
  6. else
  7.         set Cap to (do shell script "ioreg -wO -l | grep Capacity")
  8.         tell Cap to set {Available, Max} to {last word of paragraph 2, last word of paragraph 1}
  9.         set Pct to round (100 * Available / Max)
  10.  
  11.         if Pct <= 4 then
  12.                 tell application "iTunes"
  13.                         pause
  14.                 end tell
  15.                 set volume 100
  16.                 do shell script "say -v \"Zarvox\" \"LOW BATTERY\" "
  17.                 if Pct <= 3 then
  18.                         beep 5
  19.                         do shell script "say -v \"Zarvox\" \"PLUG ME IN NOW MOTHER FUCKER\""
  20.                 end if
  21.         end if
  22. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement