EchoC

Download

echoc is a little program I wrote on request. Someone had used Timo Salmi's ECHOC command line program, but it ruined the buffer if the window was not 80x25. The person asking had seen my Console unit and asked me if I could write a program that did the same, using the Console unit.

The program outputs the main part of the command line using the foreground and background colours given. Using the Console unit, it was really a piece of cake.

Synopsis

echoc bg fg <text>

Parameters

The fg and bg parameters can have values of 0..15 and consitute the foreground and background colour of the line respectively. The colours are the colours given in Console.pas:

const
  // Background and foreground colors
  Black        = 0;
  Blue         = 1;
  Green        = 2;
  Cyan         = 3;
  Red          = 4;
  Magenta      = 5;
  Brown        = 6;
  LightGray    = 7;

  // Foreground colors
  DarkGray     = 8;          
  LightBlue    = 9;
  LightGreen   = 10;
  LightCyan    = 11;
  LightRed     = 12;
  LightMagenta = 13;
  Yellow       = 14;
  White        = 15;

Blinking is not supported, and the blink bit will set the top bit of the background colour, so you also have all 16 colours shown above as background too.

The rest of the parameters is simply displayed, each parameter separated by one space character. But if you put parameters in quotes, the text will be taken literally, and multiple spaces will be displayed, if they appear in the string.

The original program would not display any newlines, so to get newlines, you had to do something like:

@echo off
echo.
echoc 15 0 This is black on white
echo.
echoc 14 12 This is bright       red on yellow
echo.
echo.

Screenshot of first batch

I decided to add a special character to the string to indicate a newline: ^. So now you can do:

@echo off
echoc 15 0 "^This is black on white^"
echoc 14 12 "This is bright       red on yellow^^^with newlines^^"

Screenshot of second batch

Disclaimer

echoc is freeware. All rights are reserved. Its code is provided as is, expressly without a warranty of any kind. You use it at your own risk.

I hope this code is useful to you. If you use some of it, please credit me. If you modify or improve the program, please send me the modifications.

I may improve or enhance echoc myself, and I will try to post changes here. But this is not a promise. Please don't request features.

Rudy Velthuis