Power Status (was Re: Because LC can't do two things at once.)
Peter M. Brigham
pmbrig at gmail.com
Fri Mar 6 10:53:06 EST 2015
So can a couple of Unix users out there test this part out?
if there is a file "/sys/class/power_supply/BAT0" then
put url "/sys/class/power_supply/BAT0" into tStatus
else if there is a file "/sys/class/power_supply/BAT1" then
put url "/sys/class/power_supply/BAT1" into tStatus
else
return "AC"
-- no battery, must be running off external power
end if
put word 1 of tStatus into tStatus
if tStatus = empty then return empty
return caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")
-- if tStatus = empty, returns empty --
-- Unix users please test: should this return some value??
-- if tStatus is not in "discharging,charging,unknown,full" then
-- just returns whatever "/sys/class/power_supply/BATx" reports
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list