Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "AmigaOS Manual: AmigaDOS Advanced Features"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
(Created page with "The information in this appendix is intended for experienced AmigaDOS users. It includes the following: * Customizing the window * Customizing your Shell environment * Using ...")
 
Line 80: Line 80:
   
 
The standard escape sequences for console windows are:
 
The standard escape sequences for console windows are:
  +
  +
{| class="wikitable"
  +
! Sequence !! Action
  +
|-
  +
| Escc || Clears the window and resets all modes to defaults.
  +
|-
  +
| Esc[0m || Resets graphics modes to defaults.
  +
|-
  +
| Esc[1m || Turns on text boldface.
  +
|-
  +
| Esc[3m || Turns on text italic.
  +
|-
  +
| Esc[4m || Turns on text underlining.
  +
|-
  +
| Esc[7m || Turns on reverse video text.
  +
|-
  +
| Esc[8m || Makes text match background color.
  +
|-
  +
| Esc[22m || Turns off boldface.
  +
|-
  +
| Esc[23m || Turns off italics.
  +
|-
  +
| Esc[24m || Turns off underlining.
  +
|-
  +
| Esc[27m || Turns off reverse video.
  +
|-
  +
| Esc[28m || Returns the text color to normal.
  +
|-
  +
| Esc[30m || Turns on text color0 (background, default grey).
  +
|-
  +
| Esc[31m || Turns on text color1 (shadow, default black).
  +
|-
  +
| Esc[32m || Turns on text color2 (shine, default white).
  +
|-
  +
| Esc[33m || Turns on text color3 (accent, default blue).
  +
|-
  +
| Esc[3#m || Turns on text color# (4-7).
  +
|-
  +
| Esc[39m || Turns on text default color (color1).
  +
|-
  +
| Esc[40m || Turns on text background color0 (default grey).
  +
|-
  +
| Esc[41m || Turns on text background color1 (default black).
  +
|-
  +
| Esc[42m || Turns on text background color2 (default white).
  +
|-
  +
| Esc[43, || Turns on text background color3 (default blue).
  +
|-
  +
| Esc[4#m || Turns on text background color# (4-7).
  +
|-
  +
| Esc[49m || Turns on default text background color (color0).
  +
|-
  +
| Esc[#u || Sets maximum length of lines in window to #.
  +
|-
  +
| Esc[#t || Sets maximum number of lines in window to #.
  +
|-
  +
| Esc[#x || Starts text # pixels from left edge of window.
  +
|-
  +
| Esc[#y || Starts text # pixels from top edge of window.
  +
|}
  +
  +
The escape sequence is executed when you press Return or when the string containing the sequence is printed.
  +
  +
Certain characters cannot normally be used in string arguments for AmgaDOS commands. Preceding these characters with an asterisk allows them to be used in string arguments for most commands, as follows.
  +
  +
{| class="wikitable"
  +
| *E || Represents the Escape key in a string.
  +
|-
  +
| *N || Forces a new line in the output.
  +
|-
  +
| *" || Allows a quotation mark character inside quotation marks.
  +
|-
  +
| ** || Gives a single asterisk.
  +
|}

Revision as of 23:42, 29 January 2014

The information in this appendix is intended for experienced AmigaDOS users. It includes the following:

  • Customizing the window
  • Customizing your Shell environment
  • Using Escape sequences
  • Customizing startup files

Customizing the Window

The Shell supports a WINDOW Tool Type in the Shell icon that allows you to specify the size, position, and features of the Shell window. The format of the Tool Types is as follows:

WINDOW=CON:x/y/width/height/title/option/options

For a description of the options and arguments for the Shell window specification, see the description of the NEWSHELL command in Chapter 6 and the examples in Chapter 8.

Public Screens - PUBSCREEN Option

Applications creating screens can mark them as public, enabling other applications and utilities to open windows on the same screen. AmigaDOS commands that have PUBSCREEN/K in their templates allow the commands to open windows on public screens.

For example, the Input Preferences editor template contains PUBSCREEN/K; open this editor on a public screen by entering the following:

1> INPUT PUBSCREEN "public screen name"

You must supply the name of the public screen. The internal names for public screens are given by applications and do not necessarily match the screen title printed in the screen's title bar. A screen's name can be the same as the application's name; however, consult the application's documentation to determine if it opens public screens and how it names them.

Customizing the Shell

You can customize your Shell environment by changing the S:Shell-startup file, which is a script that is executed each time a new Shell is opened. You can edit Shell-startup to set up command aliases and to change the Shell prompt.

Using Aliases

An aliases is an abbreviation for a long and/or frequently used command. Aliases can be local or global. Local aliases are entered in a Shell window and are only recognized in that Shell. Global aliases area entered into the Shell-startup file and are recognized by all Shells.

The Alias format is as follows:

ALIAS <name> <string>

where <name> is the alias name to be entered at the Shell prompt to execute a command. The <string> is the command line to be executed.

See Chapter 6 for a full description of the ALIAS command and Chapter 8 for a list of useful aliases.

Changing the Prompt

The PROMPT command lets you customize the Shell prompt. By default, it shows the process number, a period, the current directory, a right angle bracket (>), and a space:

1.Workbench:>

The prompt can display almost anything, with or without the process number and directory information. The return code of the last command executed can be included. The prompt can contain escape sequences, allowing you to change text color and style in the prompt string or clear the screen.

Benefits of customizing your Shell prompt include making the prompt:

  • Easier to distinguish from commands and their output
  • Match a prompt style with which you are familiar
  • More informative
  • Shorter

See Chapter 8 for examples of how to use escape sequences to make the prompt more readable.

Using Escape Sequences

Escape sequences can control how the text appears in a console window, such as the texrt color, style (bold, italics, underline), and margins. AmigaDOS recognizes standard ANSI X3.64 sequences entered on the command line or embedded in strings. Escape sequences consist of one or more characters, sometimes with a numerical argument, prefaced by the escape character. Spaces are not normally used in the sequence of characters.

The escape sequence is shown using the following format:

Esc[#X

where:

Esc Represents the Escape key. Press Esc or substitute *E if you are in an application such as ED that uses the Esc key for its own purposes. When you press Esc, a reversed-color open bracket ([) appears in the console window.
[ Represents the open bracket key, displayed in Figure D-1. If you country's keyboard does not have an open bracket key, press Alt plus the key shown, regardless of what is shown on the keycap.
# Represents a numerical argument.
X Represents an alphabetic key. Escape codes are case-sensitive. If an upper case letter is shown, press Shift and the key. If a lower case letter is shown, press the unshifted key.
Open Bracket Key Location

The standard escape sequences for console windows are:

Sequence Action
Escc Clears the window and resets all modes to defaults.
Esc[0m Resets graphics modes to defaults.
Esc[1m Turns on text boldface.
Esc[3m Turns on text italic.
Esc[4m Turns on text underlining.
Esc[7m Turns on reverse video text.
Esc[8m Makes text match background color.
Esc[22m Turns off boldface.
Esc[23m Turns off italics.
Esc[24m Turns off underlining.
Esc[27m Turns off reverse video.
Esc[28m Returns the text color to normal.
Esc[30m Turns on text color0 (background, default grey).
Esc[31m Turns on text color1 (shadow, default black).
Esc[32m Turns on text color2 (shine, default white).
Esc[33m Turns on text color3 (accent, default blue).
Esc[3#m Turns on text color# (4-7).
Esc[39m Turns on text default color (color1).
Esc[40m Turns on text background color0 (default grey).
Esc[41m Turns on text background color1 (default black).
Esc[42m Turns on text background color2 (default white).
Esc[43, Turns on text background color3 (default blue).
Esc[4#m Turns on text background color# (4-7).
Esc[49m Turns on default text background color (color0).
Esc[#u Sets maximum length of lines in window to #.
Esc[#t Sets maximum number of lines in window to #.
Esc[#x Starts text # pixels from left edge of window.
Esc[#y Starts text # pixels from top edge of window.

The escape sequence is executed when you press Return or when the string containing the sequence is printed.

Certain characters cannot normally be used in string arguments for AmgaDOS commands. Preceding these characters with an asterisk allows them to be used in string arguments for most commands, as follows.

*E Represents the Escape key in a string.
*N Forces a new line in the output.
*" Allows a quotation mark character inside quotation marks.
** Gives a single asterisk.