Sending User-Defined Character Sequences to a Host ================================================== TNVT220 and Host Presenter let you attach a character sequence or a string to a PC key. For example, you can attach a special escape sequence required by a specific application or a shortcut key for a frequently used command sequence to a selected key. Once attached, you can send this sequence to the host by simply pressing the selected key. You can attach character sequences with a maximum length of 256 bytes to 15 PC keys. TNVT220 and Host Presenter let you attach character sequences to PC keys by using the user-defined keys (DECUDK) feature of the DEC-VT220 terminals and the LAN WorkPlace for DOS utility KEY220. Overview The user-defined keys feature lets you program (that is, attach a character sequence to) VT220 function keys Shift-F6 through Shift-F20. In Host Presenter and TNVT220 these function keys are mapped to PC keys using the KEY220 program. When you program the VT220 function keys, you are actually programming the PC keys mapped to these keys. For example, in TNVT220, you can use the DECUDK feature to attach the string "mail" to the VT220 function key Shift-F6. If you map the VT220 Shift-F6 function key to the PC key Shift-F6 when you press Shift-F6 on your PC, VT220 Shift-F6 is sent to the host which translates that into"mail". Function key definitions are erased when you exit from TNVT220 or Host Presenter; however, you can easily define your personal function key definitions by specifying a file that can be run from your .cshrc file on aUNIX host. This technique enables you to download your user-defined keys automatically each time you log into your UNIX host. For example, on a UNIX host you could define key sequences in a file called SETUDKS. Then in your .cshrc file you could include the command cat SETUDKS to send the contents of the SETUDKS file to TNVT220 or Host Presenter. This method will redefine your DECUDKs every time you log in. Example: The following example illustrates how to define a function key. In this case function key F6 is defined to the UNIX command mail. Step 1. First, you need to map the PC key F6 to a programmable VT220 function key. You can edit the default keymapping file (xln\sample\extmap.txt for tnvt220, xln\sample\unix_map.txt for Host Presenter) or make your own copy of it. Change the lines: F6= F6; Shift F6= Shift F6; to: F6= Shift F6; # or NULL if you like Shift F6= F6; Recompile the mapping file with the command: "KEY220 extmap.txt extmap.bin" for tnvt220 "KEY220 unix_map.txt unix_map.win" for Host Presenter and then copy the new extmap.bin to the xln\hstacc directory. Refer to the KEY220 section of you LWP Manuals for a detailed description of this utility. Step 2. Now, on the host side you need to echo, cat (unix) or type (vms) the escape sequence: ESCP0;1|17/6D61696C0DESC\ Remember that when you enter the device control string, it must not contain any embedded spaces. If it does, it will fail! This sequence consists of the following individual entries, which are explained in the paragraphs below: ESC P 0; 1 | 17 / 6D61696C0D ESC \ ESC P indicates the beginning of the device control sequence. NOTE: You need to use an ASCII text editor (for example, vi on your UNIX host or Brief on your PC) that accepts escape characters. ESC P is displayed by vi as ^[P. You enter this sequence when using vi by pressing letter i to shift to insert mode, then pressing Control v, the ESC key, and then the P key (not by typing the characters ^[P). 0 is the clear parameter. This value clears all function-key definitions before loading this new definition. It must be followed by a semicolon (;). 1 is the lock parameter. This value does not lock the value of this function key. (0 is the lock value.) The vertical bar (|) indicates that the device control string you are defining is to be used for a user-defined key. 17 (as indicated in Table 1) indicates that you are defining the sequencefor the Shift-F6 key. It must be followed by a slash (/). 6D61696C0D corresponds to the hexadecimal equivalent of the characters mail (followed by a carriage return). These are the characters transmitted when you press Shift-F6 in TNVT220 or Host Presenter. (Shift-F6 is the first available progammable key.) ESC \ delineates the end of the user-defined key definition sequence. Table 1 Key Selector Numbers for Definable VT220 Function Keys Function Key Key Selector Function Key Key Selector ========================== ============================ Shift-F6 17 Shift-F13 25 Shift-F7 18 Shift-F14 26 Shift-F8 19 Shift-F15 28 Shift-F9 20 Shift-F16 29 Shift-F10 21 Shift-F17 31 Shift-F11 23 Shift-F18 32 Shift-F12 24 Shift-F19 33 Shift-F13 25 Shift-F20 34 Sample File > VT220 Shift-F6 mapped to mail > VT220 Shift-F7 mapped to ls -al > VT220 Shift-F8 mapped to lpr -Pps This command pauses and lets you enter the name of the file to be printed before executing the command. > VT220 Shift-F9 mapped to lpq -Pps > VT220 Shift-F10 mapped to Esct1 The characters indicate a carriage return. Sample SETUDKS file ------------------------------------------------------------------------------ EscP0;1|17/6D61696C0DEsc\ Shift-F6 = mail EscP1;1|18/6C73202D616C0DEsc\ Shift-F7 = ls -al EscP1;1|19/6C7072202D507073Esc\ Shift-F8 = lpr -Pps EscP1;1|20/6C7071202D5070730DEsc\ Shift-F9 = lpq -Pps EscP1;1|21/1B7401Esc\ Shift-F10 = Esct1 ------------------------------------------------------------------------------ As indicated earlier, the command cat SETUDKS in your .cshrc file will set your user-defined keys every time you log in. Refer to Digital's DEC VT220 Programmer's Reference Manual and LAN WorkPlace Administrator's Guide for more information.