Power Status (was Re: Because LC can't do two things at once.)
Michael Doub
mikedoub at gmail.com
Sat Mar 7 08:29:59 EST 2015
Thanks Mark. I cut and pasted that last attempt and did not catch the
caseSwitch.
-= Mike
On 3/7/15 1:27 AM, Mark Wieder wrote:
> -- Unix, thanks to Richard Gaskin, use-LC list
> constant kBatteryStatus0 = "/sys/class/power_supply/BAT0/status"
> constant kBatteryStatus1 = "/sys/class/power_supply/BAT0/status"
> if there is a file (kBatteryStatus0) then
> open file (kBatteryStatus0) for read
> read from file (kBatteryStatus0) until eof
> put it into tStatus
> close file (kBatteryStatus0)
> else if there is a file (kBatteryStatus1) then
> open file (kBatteryStatus1) for read
> read from file (kBatteryStatus1) until eof
> put it into tStatus
> close file (kBatteryStatus1)
> 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
More information about the use-livecode
mailing list