Amiga World Official AmigaDOS 2 Companion - eBook-ENG

Page 310

292

AmigaWorld Official AmigaDOS 2 Companion

Console Control Characters One of the most interesting uses for Echo is sending console-control characters to the CON: device. Console-control characters let you make changes to the console device such as clearing the window, changing the type style to bold or italic, and using inverse characters for output.

Console-control characters come in two flavors: immediate commands and escape-sequence commands. In Chapter 7, you learned about the immediate commands involved in command-line editing. One more you should know about is CTRL-L, the form feed character. This command clears the Shell window and moves the cursor to the top of the window. The most interesting console characters are the escape-sequence commands, which are so called because they are all preceded by the escape character. You can send these to the console device with the Echo and Prompt commands. Because the escape character is nonprintable, the console device recognizes the character combination *E as the escape character when it appears within a string. The console device also recognizes *N as the newline character. There are about 20 console-control escape sequences, but most are rarely used formatting commands that are of little interest to most people. I've listed those commands, with short comments, in Figure 10-4. The two most interesting escape sequences are:

*Ec This sequence resets the graphics mode to normal and clears the screen. *E[ÂŤ;ÂŤ;...mn This sequence sets the graphics rendition mode, where n is any number of the following: 0

set type style to plain text

1

set type style to boldface

3

set type style to italic

4

set type style to underline

7

use inverse type

3w

set foreground text color to n, where n is a number from 0 to 7

An

set background text color to n, where n is a number from 0 to 7

To move down two lines, set the text style of the Shell window to bold italic inverse, print a message, reset to plain text, and move the cursor down two more lines, you enter: ECHO "*N*N*E[l;3;7m Hello, World *E[0m*N*N"


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.