Guest User

Untitled

a guest
Aug 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. do shell script "pmset -g batt | grep InternalBattery | column -t"
  2. set x to the result
  3. set percentage to word 6 of x
  4. set state to word 7 of x
  5. set t1 to word 8 of x
  6. set t2 to word 9 of x
  7. set remaining to the word 10 of x
  8. if remaining contains "remaining" then
  9. if state is "discharging" then
  10. return percentage & "%"
  11. else if state is "charging" then
  12. return percentage & "% | " & "charging"
  13. else
  14. return percentage & "% | charged"
  15. end if
  16. else
  17. return percentage & "% | " & "calculating"
  18. end if
Add Comment
Please, Sign In to add comment