maxthebuilder
December 11th, 2007, 11:03 PM
Hello,
I have this lua code in ccf lua script (thanks to the author!) which switches off PPC's screen after 60 sec of inactivity.
I tried to modify it so that it would only work if the PPC runs on batteries (i.e. when running on AC power, the screen stays on all the time).
I added a piece of if-code watching the power.ac variable (1 - ac power, 0 - battery) --> now the screen stays on no matter what..
Can someone please tell me what I did wrong? I tried all kinds of variants .. ==, =, ~=, 0, '0', tonumber()...
Here's the code
if (NetRemote.GetVariable('NRCFG.Platform') == 'WINCE') then
function BlankScreen( )
if (Power.AC == '0' ) then
if (tonumber( NetRemote.GetVariable( "Utility.TimeSinceLastAction" )) > 60000) then
NetRemote.ExecuteAction( -999, 3, 4 );
end;
end;
end;
-- Create a timer to call the BlankScreen function once per minute
pScreenTime = NetRemote.SetTimer( 60000, BlankScreen );
end;
Thanks mucho!
--max
I have this lua code in ccf lua script (thanks to the author!) which switches off PPC's screen after 60 sec of inactivity.
I tried to modify it so that it would only work if the PPC runs on batteries (i.e. when running on AC power, the screen stays on all the time).
I added a piece of if-code watching the power.ac variable (1 - ac power, 0 - battery) --> now the screen stays on no matter what..
Can someone please tell me what I did wrong? I tried all kinds of variants .. ==, =, ~=, 0, '0', tonumber()...
Here's the code
if (NetRemote.GetVariable('NRCFG.Platform') == 'WINCE') then
function BlankScreen( )
if (Power.AC == '0' ) then
if (tonumber( NetRemote.GetVariable( "Utility.TimeSinceLastAction" )) > 60000) then
NetRemote.ExecuteAction( -999, 3, 4 );
end;
end;
end;
-- Create a timer to call the BlankScreen function once per minute
pScreenTime = NetRemote.SetTimer( 60000, BlankScreen );
end;
Thanks mucho!
--max