The FKEY command file sets a single function key. It demonstrates setting escape sequences with string concatenation and variable dereferencing.
Parameter input defines the key to be set by the command file (KEY), the label (L1), the string to be generated when the function key is pressed (S1), and the key attribute parameter (A1). The possible entries for the key attribute parameter are:
The commands contained in FKEY are provided in the following example. (Note that an ampersand is used to continue a lengthy command on a second line. The CI will concatenate the first and second lines to execute the command.)
Figure 7-3 Function Key Command File
PARM KEY,L1=" ",S1=" ",A1=2
IF HPJOBTYPE="S" AND HPDUPLICATIVE THEN
ECHO ![CHR(27)]&f!"A1"a!"KEY"k&
![LEN"!L1"]d![LEN("!S1")]L!L1!S1
ECHO ![CHR(27)]&jB
ENDIF
COMMENT ** END OF FKEY **
|
To set the F1 key to perform a test and display a message, the following command string would be entered.
FKEY 1,test,'echo this is a test'
|
Once the command string has been entered, pressing the F1 key results in the following display:
Figure 7-4 FKEY Sample Output
:echo this is a test
this is a test
|