Power Status (was Re: Because LC can't do two things at once.)

Peter M. Brigham pmbrig at gmail.com
Sat Mar 7 07:32:37 EST 2015


On Mar 6, 2015, at 11:48 PM, Richard Gaskin wrote:

> Peter M. Brigham wrote:
> 
> > So the acid test is what works. Can someone please test it on a
> > unix machine and tell us what the format for the URL should be?
> > And whether all the cases for the file contents are covered?
> 
> OS X is a certified Unix, so as far as bash is concerned what works there will work on most Unix systems.
> 
> In general terms (read, "for programs other than LC") Mark spot-on with the "<class><colon><slash><slash><URI>" convention.  But as in so many other areas, LiveCode seems a little different.
> 
> For file access on Linux (and Mac and Windows) I always use simply "file:/path/to/somefile" and it works well.
> 
> Back to the original power status question, oddly enough the file I/O routines LC uses don't seem to allow me to use the same URL syntax we use for files.
> 
> This works, though:
> 
>   put shell("cat /sys/class/power_supply/BAT1/status")

So, in the Linux case:
-- some machines use "BAT0" instead?
-- shell("cat /sys/class/power_supply/BAT1/status") returns either "discharging", "charging" ,"unknown", or "full"?
-- Are there other possible results that should be covered?

In other words, once we settle how to access the info, what does it look like? I'm trying to check the logic of the handler. Does it actually work on Linux now?

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list