Path: utzoo!attcan!uunet!husc6!rutgers!gatech!mcnc!ecsvax!uchuck
From: uchuck@ecsvax.uncecs.edu (Charles Bennett)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Help w/ F-keys
Message-ID: <5602@ecsvax.uncecs.edu>
Date: 15 Aug 88 19:21:21 GMT
References: <13.23016A13@rubbs1.FIDONET.ORG>
Organization: UNC - Chapel Hill
Lines: 66

In article <13.23016A13@rubbs1.FIDONET.ORG>, Mark.Medici@rubbs1.FIDONET.ORG (Mark Medici) writes:
> I am looking for the proceedure to reprogram the IBM PC/AT enhanced
> keyboard function keys to run frequently used commands under DOS 3.3.
> I would like to be able to program the  and  function keys
> to enter the following commands at the DOS prompt:
>    
>     -------- execute batch file called "CLR.BAT"
>     -------- execute batch file called "HELP.BAT"
>     - execute batch file called "HOME.BAT"
>     - execute program called "MENU.EXE"
>    
> I think that this should be possible using ANSI.SYS commands, but
> have not been able to find information on how to do so.  I have also
> tried the ShareWare program "SETKEY", but it doesn't handle the 
> and  function keys, has problems with other TSR software, and
> won't relinquish the programmed function keys to application software.
>    
> Also, I would appreciate recommendations of a good reference for using
> the ANSI.SYS driver.  Something written in english, not Anglo-MSIBM.
>    
> 
> --  
> 
> Mark Medici - via FidoNet node 1:107/330
> UUCP: ...!rutgers!rubbs1!Mark.Medici
> ARPA: Mark.Medici@rubbs1.FIDONET.ORG
> \...!rutgers!rubbs1!Mark.Medici


The proper reference is the Technical Reference Manual for PC-DOS 3.3.
The Chapter is number 3, "Using Extended Screen and Keyboard Control".
The page is 3-17, "Keyboard Key Reassignment".

The command sequence for ANSI.SYS is as follows:
        ESC[#;#;"string";#p
The first two #'s are the extended ASCII for the key to be redefined.
The string and/or second # is waht the new definition is.  The extended
ASCII codes for keys can be found on page 6-11 and 6-12 of the same
manual.  EXCEPT, F11 and F12 aren't there.  The table below gives values
for them.

    KEY     CODES--------------------------------------
            Un-Sft    Shifted    Ctl'ed     Alt'ed
    F11     0;122     0;135      0;137      0;139
    F12     0;123     0;136      0;138      0;140

So your examples would look like this:

 ESC[0;122;'CLR.BAT';13p
 ESC[0;123;'HELP.BAT';13p
 ESC[0;135;'HOME.BAT';13p
 ESC[0;136;'MENU.EXE';13p

The 13 is a  and ESC is the escape key.  One simply puts these
commands in a file and issues a "TYPE filename" command.  Don't get to 
carried away with this (I did), there is a limit of approximately 208
bytes of redefinition space in ANSI.SYS.  And I haven't found a way to
expand it.

This is not intended to be a complete lesson on the subject, PLEASE see
the references.
-- 
                   -Chuck Bennett-  UNC - Chapel Hill
                    919-966-1134
                    uchuck@ecsvax.UUCP
                    uchuck@unc.BITNET