Go to:  Davar site entry | Site contents | Site index | Personal computer | 4DOS | Text bottom

SETCOLOR  4DOS  Batch  Command

SETCOLOR batch command sets ANSI codes to environment variables for later usage in another batch commands.  Normally SETCOLOR is called from AUTOEXEC.BAT at boot time or from batch command used to configure DOS session which is opened under Windows.  Alternatively SETCOLOR command command may be entered at any time with appropriate parameter to control color of the messages being displayed.

SETCOLOR H command demonstrates preset colors and corresponding variables, gives suggestion of color usage, and shows several examples of colorized messages.

Notes:
 • ANSI.SYS should be installed from CONFIG.SYS or CONFIG.NT to enable DOS session colors.
 • "Escape" symbol 27 (left arrow) is displayed below as "".
 • Mono color patterns are given below only as samples.



:  SETCOLOR  Set Standard ANSI Color Escape Codes  03/21/1996-10/15/1999
:  ---------------------------------------------------------------------
:  Copyright (C) 1996-1999 by Vladimir Veytsel             www.davar.net

:  1. Operation mode:
:     "?"  - Display SETCOLOR batch command text (Equivalent:  "/")
:     ""   - Autodetect (4DOS) monitor type (color or mono CRT)
:            NB:  Mono LCD monitor can't be autodetected!
:     "0"  - Cancel ANSI escape codes (turn Black-and-White)
:     "Z"  - Cancel ANSI escape codes (turn Black-and-White)
:     "C"  - Set ANSI escape codes for color    monitor
:     "M"  - Set ANSI escape codes for mono CRT monitor (television-like)
:     "L"  - Set ANSI escape codes for mono LCD monitor (calculator-like)
:     "H"  - Display ANSI color help and message samples
:            (anything except above mentioned is treated as help request)

:     Notes:

:      - CONFIG.SYS should contain ANSI.SYS installation line:
:        "DEVICE=C:\DOS\ANSI.SYS"             for native DOS boot
:        "DEVICE=C:\WINDOWS\COMMAND\ANSI.SYS" for Windows-95 DOS session

:      - CONFIG.NT  should contain ANSI.SYS installation line:
:        "DEVICE=C:\WINNT\SYSTEM32\ANSI.SYS"  for Windows-NT DOS session

:      - If ANSI.SYS is not installed, colors are deactivated

@ECHO %TR%

 IF %1.==/. .OR. %1.==?. (LIST %_BATCHNAME ^ QUIT)

 SET SCL=%1 ^ IF %SCL%.==. SET SCL=%@SUBSTR[%_MONITOR,0]
 SET SCL=%@UPPER[%SCL%]
 IFF %_ANSI==0 THEN
     @ECHO ANSI.SYS is not installed
     SET SCL=0
 ENDIFF

 IFF %SCL%.==0. .OR. %SCL%.==Z. THEN
     SET R=
     SET G=
     SET Y=
     SET B=
     SET M=
     SET C=
     SET W=
     SET D=
     @ECHO %S%Screen colors are deactivated
     QUIT
 ELSEIFF %SCL%.==C. .OR. %SCL%.==COLOR. THEN
     SET R=  ^:  Bright Red
     SET G=  ^:  Bright Green
     SET Y=  ^:  Bright Yellow
     SET B=  ^:  Bright Blue
     SET M=  ^:  Bright Magenta
     SET C=  ^:  Bright Cyan
     SET W=  ^:  Bright White
     SET D=     ^:  Gray (DOS regular)
     QUIT
 ELSEIFF %SCL%.==M. .OR. %SCL%.==MONO. THEN
:     Sample Mono CRT pattern follows:
     SET R=  ^:  Bright White
     SET G=  ^:  Bright White
     SET Y=  ^:  Bright White
     SET B=  ^:  Bright White
     SET M=  ^:  Bright White
     SET C=  ^:  Bright White
     SET W=  ^:  Bright White
     SET D=     ^:  Gray (DOS regular)
     QUIT
 ELSEIFF %SCL%.==L. THEN
:     Sample Mono LCD pattern follows:
     SET R=  ^:  Bright White
     SET G=  ^:  Bright White
     SET Y=  ^:  Bright White
     SET B=  ^:  Bright White
     SET M=  ^:  Bright White
     SET C=  ^:  Bright White
     SET W=  ^:  Bright White
     SET D=     ^:  Gray (DOS regular)
     QUIT
 ELSE
     CLS
     @ECHO %G%ANSI Codes Demo  (in Terms of Color Monitor)
     @ECHO --------------------------------------------
     @ECHO %R%Bright Red:       R  - Error message
     @ECHO %G%Bright Green:     G  - Title, info or disk name/letter
     @ECHO %Y%Bright Yellow:    Y  - Command name or text accent
     @ECHO %B%Bright Blue:      B  - Status message
     @ECHO %M%Bright Magenta:   M  - Error message highlight
     @ECHO %C%Bright Cyan:      C  - Key, status msg h/l or compl message
     @ECHO %W%Bright White:     W  - Request or text highlight
     @ECHO %D%Gray:             D  - DOS regular text
     @ECHO:
     @ECHO %G%Several examples follow:%D%
     @ECHO:
     @ECHO %W%Insert %G%DDDD %W%disk into floppy drive %G%A:  %W%and hit %C%[Enter]%D%
     @ECHO %W%Hit %C%[Enter] %W%to play %Y%next %W%tune or %C%[Esc] %W%to %Y%quit%D%
     @ECHO %R%Wrong disk %M%XXXX %R%is inserted instead of requested %M%DDDD%D%
     @ECHO %R%Free space on disk %M%DDDD %R%is only %M%12 %R%Kilobytes%D%
     @ECHO %B%Batch command %C%tracing %B%mode is now %C%OFF%D%
     @ECHO %G%Execution will take some time, please wait...%D%
     @ECHO Reading source file(s)...
 ENDIFF
 UNSET SCL
  



   Fri  8/20/99 21:17  C:\> SETCOLOR H

   ANSI Codes Demo  (in Terms of Color Monitor)
   --------------------------------------------
   Bright Red:       R  - Error message
   Bright Green:     G  - Title, info or disk name/letter
   Bright Yellow:    Y  - Command name or text accent
   Bright Blue:      B  - Status message
   Bright Magenta:   M  - Error message highlight
   Bright Cyan:      C  - Key, status msg h/l or compl message
   Bright White:     W  - Request or text highlight
   Gray:             D  - DOS regular text
Several examples follow:
Insert DDDD disk into floppy drive A:  and hit [Enter] Hit [Enter] to play next tune or [Esc] to quit Wrong disk XXXX is inserted instead of requested DDDD Free space on disk DDDD is only 12 Kilobytes Batch command tracing mode is now OFF Execution will take some time, please wait... Reading source file(s)...


View [and save] SETCOLOR.BTM text
(Use [Back] button or [Alt]+[CL] to return here from the viewed text)
Copyright © 1996–1999 by
Go to:  Davar site entry | Site contents | Site index | Personal computer | 4DOS | Text top