home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 283 / Shell5SourceCode.sis / backlight.txt < prev    next >
Encoding:
Text File  |  1998-08-30  |  1.4 KB  |  52 lines

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