home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 283 / Shell5SourceCode.sis / backlight (.txt) next >
Encoding:
EPOC OPL Source  |  1998-08-30  |  1.6 KB  |  57 lines

  1.  
  2.  
  3. Rem   Backlight, an addon command for Shell5
  4. Rem   Control the backlight
  5. Rem
  6. Rem   Copyright (C) 1998  Nick Murray
  7. Rem
  8. Rem   This program is free software; you can redistribute it and/or
  9. Rem   modify it under the terms of the GNU General Public License
  10. Rem   as published by the Free Software Foundation; either version 2
  11. Rem   of the License, or (at your option) any later version.
  12. Rem
  13. Rem   This program is distributed in the hope that it will be useful,
  14. Rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. Rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. Rem   See the GNU General Public License for more details.
  17. Rem
  18. Rem   You should have received a copy of the GNU General Public License
  19. Rem   along with this program; if not, write to the Free Software Foundation,
  20. Rem   Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  21. Rem
  22. INCLUDE "System.oxh"
  23. PROC backlight%:(n%)
  24. LOCAL state%,buf$(255)
  25.     ONERR ErrTrap::
  26.     state%=BACKLIGHTON&:
  27.     IF n%=1
  28.         IF state%
  29.             fprint%:("ON")
  30.         ELSE
  31.             fprint%:("OFF")
  32.         ENDIF
  33.     ELSEIF n%>2
  34. Usage::
  35.         PRINT "Usage: backlight [on┬ªoff┬ªtoggle]"
  36.     ELSE
  37.         buf$=LOWER$(PEEK$(argv&(2)))
  38.         IF buf$="on"
  39.             state%=1
  40.         ELSEIF buf$="off"
  41.             state%=0
  42.         ELSEIF buf$="toggle"
  43.             state%=-(state%=0)
  44.         ELSE
  45.             GOTO Usage::
  46.         ENDIF
  47.         SETBACKLIGHTON:(state%)
  48.     ENDIF
  49.     RETURN BACKLIGHTON&:                Rem so scripts can query $?
  50. ErrTrap::
  51.     ONERR off
  52.     PRINT err$:(ERR)
  53.     RETURN ERR
  54. ENDP
  55.  
  56.  
  57.