home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
DOSKEYSM.ZIP
/
DOSKEYS.DOC
< prev
Wrap
Text File
|
1991-09-29
|
12KB
|
331 lines
DOSKEYS.BAT - MANAGING YOUR MACROS
I wrote this batch file for a friend who just got a PC and needed
a little help in using it. However, when it was finished, I
thought that it would be helpful for any novice user. In fact,
even if you're a pro, it's still useful to provide a quick
reminder of what your macros are. And most important, it's
free.
All you need to run it is MS-DOS 5.0. You will also need the
external DOS programs MORE and DOSKEY somewhere in your path.
You should also have the ansi.sys (or a reasonable facsimile)
loaded. DOSKEYS can run without it, but it looks a lot nicer
with it. If you used the DOS install program, they're there.
Please note that some of the sample macros included in this file
refer to other DOS external programs. Also, the last 3 samples
are for commercial and shareware software. They've been included
only as samples.
DOSKEYS is very simple. It invokes doskey with your macros and
maintains a help file to keep track of them. The help file is
built whenever DOSKEYS loads your macros, so as long as you
include the help line in DOSKEYS.BAT, it will always be up-to-
date. One of the macros included is ? which displays the help
file on your screen. Another macro, MACROS calls DOSKEYS.BAT
into an editor (MS-DOS EDIT by default) so you can change it,
then reloads the macro definitions.
To install DOSKEYS.BAT, simply copy it to your disk. It does
not NEED to be in the PATH, but if it is not, you must invoke
it with the full path name (not a relative path name). For
example c:\etc\doskeys instead of etc\doskeys. This is necessary
because some of the sample macros need to run DOSKEYS and the
only way they know where to find it is through the PATH or from
the command line. Also, if a full pathname is not used, the
MACROS macro will work only if DOSKEYS.BAT is in the current
directory.
To run DOSKEYS simply type its name at the DOS prompt. For
example, if you put DOSKEYS.BAT in your c:\ directory, you
would type c:\doskeys. You can run it automatically at boot time
by adding the following line to your autoexec.bat file:
call c:\doskeys
It is recommended that you use the full pathname, but DO NOT
include the .bat extension.
DOSKEYS.BAT - MANAGING YOUR MACROS
CUSTOMIZING
DOSKEYS should run as is on most systems, but there are a few
things that can be done to customize it. The most obvious is
adding your own macros. Refer to the next section for details on
adding macros.
To customize DOSKEYS.BAT, you'll have to edit it. If you must
use a word processor such as WordPerfect or Wordstar, make sure
you edit it in NON-DOCUMENT (ASCII) mode. As an alternative,
use the EDIT command supplied with MS-DOS 5.0.
Lines 2 through 6 of DOSKEYS.BAT contain a series of SET
commands. These variables control the execution of DOSKEYS.
DO NOT remove these lines. DOSKEYS will not run without them!
The first one is CMD. This tells DOSKEYS where to find the MS-
DOS command doskey.com. If doskey.com is in your path, you can
leave it as is. Otherwise set this to the full pathname of the
doskey.com program. example: set CMD=c:\dos\doskey
Next is KTX. This is the name and location of the file that
DOSKEYS will put help info into. This can be any filename you
like. The default is c:\doskeys.$$$. NOTE: this must be a full
pathname. If it is not, you could end up with help files all
over your disk. Anytime DOSKEYS cannot find the file, it
creates it.
BUFS. This is the size of the doskey.com buffer. Refer to the
doskey documentation for more info.
ANS yes or no. This tells DOSKEYS whether or not you are using
an ANSI console driver (such as ANSI.SYS). When set to yes
(lower case only), DOSKEYS will use ANSI sequences to pretty up
the screen. If you do not use an ANSI driver, set this to any
value but "yes" (no would be a logical choice). If your not
sure, look in your CONFIG.SYS file for a line like:
DEVICE=C:\DOS\ANSI.SYS
Further, if you see a bunch of [1;m junk when DOSKEYS displays
the help screen, change this to no.
DOSKEYS.BAT - MANAGING YOUR MACROS
CUSTOMIZING
CRT color or mono. If you have a color screen (and ANS=yes),
DOSKEYS will use color to display the help screen. If you want
colors and you have ANSI.SYS loaded, set this to "color" (lower
case, not quotes). NOTE that a side effect of using ANSI
sequences is that DOSKEYS will change your default DOS color.
The default is the DOS default of grey on black. Sorry, but I
don't know of any way to detect the current color from a .BAT
file. If you want to change this color, locate the lines near
the end of DOSKEYS.BAT that read:
rem THE NEXT LINE WILL SET THE COLOR OF THE DOS PROMPT
if %CRT% == color echo ?[0;37;40m?[1A>>%KTX%
if NOT %CRT% == color echo ?[0m?[1A>>%KTX%
On the second line note the 0;37;40 . The first number (0) is
the attribute. The second (37) is the foreground color. The
third (40) is the background color. To change your default
color, modify this line with values from the following table:
Attribute Foreground Background
0 normal 30 black 40 black
1 bright 31 red 41 red
4 underline 32 green 42 green
5 blink 33 yellow 43 yellow
7 reverse 34 blue 44 blue
8 invisible 35 magenta 45 magenta
36 cyan 46 cyan
37 white 47 white
The third line above does the same thing for mono systems, in
which case, only the attribute is changed. For more
information, refer to your MS-DOS documentation on ANSI.SYS.
Finally, I should point out that these variables are set and
unset within DOSKEYS so the only time they take up environment
space is when DOSKEYS is actually running. Of course, this
also means you cannot preset them.
DOSKEYS.BAT - MANAGING YOUR MACROS
ADDING MACROS
All the macros defined in DOSKEYS begin on line 33, right after
the line that looks like this -
rem START OF DEFS *********************************************
To add new macros, simply follow the examples. There is also a
template on lines 28 and 29, here it is
%CMD% MCR=
echo MCR DESCRIPTION>>%KTX%
The first line is the actual macro. The %CMD% is replaced at run
time by the doskey command. It can also be replaced by the REM
command if DOSKEYS needs to build the help file without actually
loading the definitions (just in case it's accidentally deleted).
I suggest you refer to your MS-DOS manual for details on using
the doskey command. However, there are plenty of examples to
get you started. Note that some of the definitions end with
%0 ?. The %0 is replaced at run time by the the name of the bat
file (DOSKEYS). This is why you should include the full path
name when DOSKEYS is first invoked. If you typed DOSKEYS at the
command line %0 would expand to DOSKEYS. Likewise, if you typed
C:\DOSKEYS, %0 would expand to C:\DOSKEYS. In this way there is
never any question about where DOSKEYS is located. It also
allows you to rename DOSKEYS.BAT. By the way, the ? tells
DOSKEYS to simply display the help screen.
The second line is what builds the help file. the ECHO command
tells DOS to send whatever follows it to standard out (your
screen). However, the >>%KTX% tells DOS to append that output
to a file. The %KTX% is expanded to whatever you called your
help file (by default c:\doskeys.$$$). Make sure you use two
greater than (>) symbols or you will erase the previous contents
of the file. Simple, but effective.
As you can see, there is no direct relationship between the
macro and the help line. You can have as many or as few help
lines as you want. You could also include help lines for
commands that are not macros. Experiment.
DOSKEYS has two primary functions:
1 - load doskey.com, define macros, and build the help file
2 - display the help file
SYNTAX:
DOSKEYS
installs doskey, macros, builds and displays the help file
DOSKEYS install
installs doskey and macros, builds but does not display
help file
DOSKEYS ?
displays the help file (if the file is not found, it
is recreated) NOTE that this is the content of the
first sample macro "?".
DOSKEYS ? home
same as DOSKEYS ?, but also sets the current directory to
DOSKEYS.BAT - MANAGING YOUR MACROS
USING DOSKEYS
C:\
DOSKEYS ? home p
same as DOSKEYS ? home, but pauses before displaying help
Please note that these paramaters are positional. They must be
typed exactly as above and must be in the proper position, that
is 1 for ? or install, 2 for home, and 3 for p. If you want to
use the second or third parm without the first use a placeholder.
For example: DOSKEYS ? x p would pause and display the help, but
without changing the directory.
Oh yes! I should point out that line 13 will install doskey.com
if it has not already been installed. If doskey has already been
installed, it will beep and display a message stating that it's
already installed. The >NUL sends that message into the void. I
suspect that most people will load doskey in their config.sys
file, but it's here just in case.
Well, that's it. I can't believe I wrote so much about a bat
file. Oh well. If you need help with any of this, feel free to
write. You can also leave E-mail on EXEC PC or COMPUSERVE.
Larry McElderry
P.O.Box 1172
Manhattan, KS 66502-0012
Compuserve ID: 74017, 1630