~Today's Top DOS Tip

By Simon Burrows


~`Intro:
~`-----

`This month  sees a more advanced Top Tip than usual.  It will allow
`you to  define the  meanings to  the F-Keys to save typing the full
`names of  frequently-used commands.   For example, you could define
`the F10 key to the DIR command, so that every time you press F10 in
`DOS, it gives you a directory listing of the present directory.


~`Method:
~`------

`This tip  requires the  use of  ANSI.SYS.  To use this, you need to
`add a  line in  your CONFIG.SYS  file as  follows :-    (You  could
`replace 'Device=' with 'Devicehigh=' to load it into high-memory)

`DEVICE=C:\DOS\ANSI.SYS      (The path C:\DOS may differ on your PC)

`When this  is loaded you can then add lines to your AUTOEXEC.BAT to
`define the F-Keys to the tasks you desire.  The best way to explain
`how to do this is to give an example :-


~`ECHO [0;68;"DIR";13p
~`                 
~`    *1   *2   *3   *4
~`                 
~`                This "13p" enters the command that  you have
~`                put at *3.
~`             
~`            This part in " "s specifies what command the key-
~`            press will do.
~`         
~`        This "0;68" specifies which key you  press to  run the
~`        command.
~`     
~`    This "" is called an 'ESC character'.


`This example  will do a list of the present directory each time you
`press F10.


`*1) This  character is  created  in  different  ways  in  different
`    programs.   The most commonly-used program to edit AUTOEXEC.BAT
`    is MS-DOS  Edit.   In MS-DOS  Edit, you  first press  ALT+P (to
`    generate a  ^P appear  at the  bottom of  the screen), then you
`    press the [ESC] key where you want the '' character to appear.

`*2) If  you want to change the task the F-Key does  (eg, instead of
`    doing a  directory listing,  clearing the  screen)  you need to
`    change the section in " "s to the new command.

`*3) If  you want  to change  which F-key you have to press to carry
`    out the  command, you  have to  change the  0;68 after the open
`    square bracket to a different ASCII code.  Here's a list of all
`    the F-key ASCII codes :-

`                     F1 - 0;59     F6  - 0;64
`                     F2 - 0;60     F7  - 0;65
`                     F3 - 0;61     F8  - 0;66
`                     F4 - 0;62     F9  - 0;67                     
`                     F5 - 0;63     F10 - 0;68

~`NOTE:  F1 &  F3 are  both used  in DOS  to  repeat  the  characters
~`       typed at  the last  prompt.  If you want these facilities to
~`       stay, you musn't assign a command over the top of them.

`*4) If you don't  have this  part in  the line, the F-Key will  put
`    your command  at the  prompt, but  not 'press' [ENTER] after it
`    for you.


~`Example:
~`-------

ECHO [0;62;"CLS";13p

This will run  the CLS command (to clear the screen) every time the 
F4 key is pressed.


~`Advanced Use:
~`------------

It is also possible for an F-Key to carry out two commands. All you
need is  a linefeed  code   (linefeed code  is 10)  between the two
commands.

For example,  if you  wanted F5 to enter the \GAMES\POOL directory,
then run  the file  POOL.EXE, then  you  would  use  the  following
command line :-

ECHO [0;63;"CD\GAMES\POOL";13;10;"POOL";13p


~Until the next time, folks....

~Simon Burrows
