[comp.sys.ibm.pc] Help w/ F-keys

Mark.Medici@rubbs1.FIDONET.ORG (Mark Medici) (08/11/88)

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 <F11> and <F12> function keys
to enter the following commands at the DOS prompt:
   
   <F11> -------- execute batch file called "CLR.BAT"
   <F12> -------- execute batch file called "HELP.BAT"
   <SHIFT><F11> - execute batch file called "HOME.BAT"
   <SHIFT><F12> - 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 <F11>
and <F12> 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

uchuck@ecsvax.uncecs.edu (Charles Bennett) (08/16/88)

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 <F11> and <F12> function keys
> to enter the following commands at the DOS prompt:
>    
>    <F11> -------- execute batch file called "CLR.BAT"
>    <F12> -------- execute batch file called "HELP.BAT"
>    <SHIFT><F11> - execute batch file called "HOME.BAT"
>    <SHIFT><F12> - 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 <F11>
> and <F12> 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 <cr> 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

feg@clyde.ATT.COM (Forrest Gehrke) (08/17/88)

In article <5602@ecsvax.uncecs.edu>, uchuck@ecsvax.uncecs.edu (Charles Bennett) writes:
> 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.
> 
.> The command sequence for ANSI.SYS is as follows:
.>         ESC[#;#;"string";#p
.> 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


One more thing (I had to learn it the hard way): 

Don't try to execute these statements with echo off.  
Ansi (nansi, fansi, or whatever) won't 'see' them and 
therefore won't act on them.

   Forrest Gehrke