Almost all DOS applications should run without change when ANSIPLUS is installed. However, in a few cases it may be desirable to create a batch file that prepares the system for an application, runs it, and then cleans up afterward. There are four common reasons for creating these application batch files:
To restore the normal DOS command shell video mode and colors after the program ends;
To install a color palette for the program to use when it runs;
To save key reassignments, change them, run a program, and restore the keys; or
To enable or disable ANSIPLUS features that conflict with the program.
Many DOS application programs do not completely restore the video state on completion. The common problems seen (with examples in parentheses) are:
The program sets the color palette, usually to the OEM default, but doesn’t restore it on completion (DOS 5.0 EDIT.com, DBASE III).
The program sets the border color, but doesn’t restore it, or sets it to black on completion (DBASE III).
The program turns blink on, but doesn’t restore it on completion (DOS 5.0 EDIT.com, DBASE III).
The program selects a video mode, but doesn’t restore the original one on completion (DOS 5.0 EDIT.com, DBASE III).
The program selects a video mode and restores it on completion, but doesn’t restore the text height if it is not standard for the video mode (Quattro Pro 3.0 and others).
There are four simple options for restoring the ANSIPLUS video mode and colors after running an application that sets its own mode, palette or border color:
The first option can be used to restore only the border color after an application has run. Suppose the border color is normally palette code 17, then the following batch file will set the border after the application (in this example, DOS EDIT.com) runs:
@ECHO OFF
C:\DOS\EDIT.com %1 %2 %3 %4 %5 %6 %7 %8 %9
SETCOLOR BORDER 17
The second option will restore the entire default ANSIPLUS palette and border color after the application runs:
@ECHO OFF
C:\DOS\EDIT.com %1 %2 %3 %4 %5 %6 %7 %8 %9
SETCOLOR RESET
The third option requires creating a small .com file that will load an entire color scheme. This can be done at any time by hitting the letter " S " from the SETCOLOR.exe palette definition screen, or it can be done from the DOS command level with a command like:
SETCOLOR SAVEPROGRAM MYCOLORSThis will create a program called MYCOLORS.com, which loads the 16-color palette and border colors that were in effect when the program was created. The batch file for the application can then use this program to restore the color scheme on completion:
@ECHO OFF
C:\DOS\EDIT.com %1 %2 %3 %4 %5 %6 %7 %8 %9
MYCOLORS
@ECHO OFF
PUSHVID
C:\DOS\EDIT.com %1 %2 %3 %4 %5 %6 %7 %8 %9
POPVID
This is the best technique to use when running DOS in a text mode other than 25 lines by 80 columns, because it will restore both the video display mode and text height.
The options for controlling colors used by applications depend on whether custom colors are desired for the application and whether the application loads its own palette:
If the application ordinarily uses ANSIPLUS’s colors when it runs, then it will use any ANSIPLUS color palette in effect when it begins execution, so a .com color scheme file saved from the SETCOLOR.exe palette definition screen, or by a SETCOLOR SAVEPROGRAM APPCOLOR command, can be used to load a custom color scheme before running the application:
@ECHO OFF
APPCOLOR <application> %1 %2 %3 %4 %5 %6 %7 %8 %9
MYCOLORS
Because most DOS application programs select a video mode when they start up, be sure that the color scheme saved in APPCOLOR.com is saved as a default color scheme.
To use the ANSIPLUS palette for an application that installs its own palette, the palette must be locked before the program starts and unlocked after it completes:
@ECHO OFF
LOCKPAL
<application> %1 %2 %3 %4 %5 %6 %7 %8 %9
UNLOKPAL
Warning: Palette locking should only be used when all other means of control fail. The feature should never be left enabled all of the time because it will keep well behaved programs from making their color changes.
To use custom colors for an application that wants to install its own palette, the custom colors are loaded before the palette is locked:
APPCOLOR
LOCKPAL
<application> %1 %2 %3 %4 %5 %6 %7 %8 %9
UNLOKPAL
MYCOLORS
If you run your system using a certain set of ANSI key reassignments most of the time, but also run an application that sets up its own key reassignments, the PUSHKEYS.com and POPKEYS.com programs supplied with ANSIPLUS can be used in batch files to save the keys before an application is started and to restore them after it completes:
@ECHO OFF
PUSHKEYS
<application> %1 %2 %3 %4 %5 %6 %7 %8 %9
POPKEYS
If you want to set up a special set of key reassignments before running an application, just define the reassignments using the SETAPLUS utility program, and then save them to a file (in this example, named APPKEYS.com) with a SETAPLUS SAVEKEYS APPKEYS.com command. You then run APPKEYS.com in your batch file after saving the keys, but before the application:
@ECHO OFF
PUSHKEYS
APPKEYS
<application> %1 %2 %3 %4 %5 %6 %7 %8 %9
POPKEYS
In the event of a conflict between an ANSIPLUS feature and an application, the feature can be disabled before running the application and enabled again after it completes. For example, the following batch file turns off the screen saver while running an application:
@ECHO OFF
SETAPLUS DISABLE SAVER
<application> %1 %2 %3 %4 %5 %6 %7 %8 %9
SETAPLUS ENABLE SAVER
© Copyright 2000-2007, Kristofer Sweger. All rights reserved. |
Rev. 10/16/07 |