home *** CD-ROM | disk | FTP | other *** search
- @echo off
- rem ┌──────────┐
- rem │ TEST.BAT │
- rem └──────────┘
- rem A minor tutorial on the ANSI commands to control the screen
- rem cursor, colors, and "special effects." ANSI.SYS must be added
- rem to the CONFIG.SYS file. First run this batch file, then read
- rem the statements above each command in this batch file.
- rem
- rem "This" means (or is equal to) the command on the next line
- rem
- rem This sets the screen to bright white on blue
- echo
- rem This clears the screen (same as CLS command)
- echo
- rem This sets the cursor to row 12 column 20 displays a message
- rem in the screen colors
- echo 20H THIS IS BRIGHT WHITE ON BLUE BACKGROUND
- rem This is DOS's pause command. It allows you to read the message
- pause
- rem This goes back to the message and erases it; uses ANSI cursor
- rem location commands (H for position, K to erase to the end of the
- rem line)
- echo 1H
- echo 1H
- rem This locates the cursor and sets a command in color
- echo 25H PRESS ENTER TO CONTINUE
- rem Nul is a DOS ==device==. It is a "bit bucket" and anything
- rem written to it is discarded. Try writing FROM Nul and see what
- rem you get (no it's not dangerous or habit forming). Used with the
- rem redirection operator (>) it suppresses the pause statement and
- rem allows you to use one of your own.
- pause>nul
- rem This erases the above command to background color
- echo H
- rem This sets the screen to bright white on green
- echo
- rem This time we don't clear the screen so only new letters
- rem change to the new colors!
- rem This sets the cursor to row 12 column 20 &
- rem This displays a message in the NEW screen colors
- echo 20H THIS IS BRIGHT WHITE ON GREEN BACKGROUND
- pause
- rem This goes back to the message and erases it
- echo 1H
- echo 1H
- rem This places the pause command on the 5th row of the screen
- echo H
- pause
- rem This erases the pause statement in the new color
- echo H
- rem This time we do three (3) things. Place the message, change the
- rem colors of just that portion of the screen and set the
- rem screen message to bright blinking red on black
- echo 20H
- rem This is non blinking red on black
- echo 25H Press any Key to Continue!
- pause>nul
- rem This goes back to the message and erases it
- echo 1H
- echo 1H
- echo 20H PRESS ANY KEY TO END......
- pause>nul
- rem And lastly, who says you can't draw colored boxes with
- rem ASCII and ANSI stuff!
- rem Just remember that ANSI code takes no space and adjust for
- rem it when making boxes, see below, if you count the spaces,
- rem you will find that the two ANSI code strings before and after
- rem "OR" take up no space so that the positions are off by the 12
- rem spaces on either side.
- rem References for this stuff are in ANSICOLR.DOC
- echo
- cls
- echo 10H ╒══════════════════════════════════════════════╕
- echo 10H │ A N S I M A D E E A S Y │
- echo 10H │ │
- echo 10H │ O R │
- echo 10H │ │
- echo 10H ╘════C O L O R F O R B A T C H F I L E S═╛
-
- echo 10H PRESS ─┘ {Enter} to say Goodbye
- pause>nul
- rem This next command is the ASCII character 7, or beep
- echo
-