home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BATUTL / BAT204C.ZIP / KEYTEST.BAT < prev    next >
Encoding:
DOS Batch File  |  1985-12-12  |  3.3 KB  |  80 lines

  1. bat     * Keyboard test routine.
  2. bat     cls begtype
  3.  
  4. ╒══════════════════════ KEYTEST ═════════════════════════╕
  5. │                                                        │
  6. │   This program will give you complete details about    │
  7. │   any key on the keyboard so that you can use a        │
  8. │   special key combination within an Extended Batch     │
  9. │   Language (EBL) program.  You are only able to use    │
  10. │   keys within EBL for which you see results.           │
  11. │                                                        │
  12. │   Refer to appendix E in your manual for a complete    │
  13. │   listing of all keys available and their results.     │
  14. │                                                        │
  15. ╘════════════════════════════════════════════════════════╛
  16.  
  17. PRESS ESC **TWICE** TO EXIT!
  18.  
  19.  
  20. end
  21. bat     %0 = 0                                          |* ESC count reset.
  22. bat -top
  23. bat     inkey Press the key to test> %a
  24. bat     if %A =  KEY01B %0 = %0 + 1 | if %0 > 1 exit    |* EXIT if 2nd ESC key.
  25. bat     if %A <> KEY01B %0 = 0                          |* reset count if not.
  26. bat     cls begtype
  27. ╒══════════════════════ KEYTEST ═════════════════════════╕
  28. ╘═════════════ (Press ESC twice to exit) ════════════════╛
  29.  
  30. The key read from the INKEY command was: ;
  31. end
  32. bat     type %A%S
  33. bat     begtype
  34. ┌────────────────────────────────────────────────────────┐
  35. │  This is the value read FROM the keyboard INTO an      │
  36. │  executing EBL program. You may test for this key      │
  37. │  by including the following statements within your     │
  38. │  program:                                              │
  39. │               BAT INKEY Press the key to use> %A       │
  40. │               BAT IF %A = ;
  41. end
  42. bat     type %A%S;
  43. bat     %1 = %A #                               |* get length of resulting value
  44. bat     if %1 = 1 type %S%S%S%S%S;              |* add space if short value
  45. bat     begtype
  46.  GOTO -doit           │
  47. └────────────────────────────────────────────────────────┘
  48.  
  49. The value to put into a BEGSTACK command is: ;
  50. end
  51. bat     if %1 = 1 %3 = %A | goto -continue      |* 1 length is simple ASCII
  52. bat     %1 = %A $ 4 1                           |* else get extended type ID
  53. bat     %2 = %A $ 5 2                           |* and get pseudo ASCII value
  54. bat     if %1 = 0 %3 = \%2                      |* make result type 0
  55. bat     if %1 = 1 %3 = \00\%2                   |* make result type 1
  56. bat -continue
  57. bat     if %3 = \ %3 = \\                       |* handle special case
  58. bat     if %3 = ; %3 = ;%S                      |* handle special case
  59. bat     type %3%S                               |* show result
  60. bat     begtype
  61. ┌────────────────────────────────────────────────────────┐
  62. │  This is the value put INTO the keyboard (stack) FROM  │
  63. │  the executing EBL program. To simulate this key,      │
  64. │  include the following statements in your EBL program: │
  65. │               BAT BEGSTACK                             │
  66. │               ;
  67. end
  68. bat     %1 = %3 #                               |* get length of result
  69. bat     type %3;%S;                             |* show result & a semicolon
  70. bat -pad
  71. bat     if %1 <> 8 | type %S; | %1 = %1 + 1 | goto -pad
  72. bat     begtype
  73.                                │
  74. │               END                                      │
  75. └────────────────────────────────────────────────────────┘
  76.  
  77. end
  78. bat     goto -top
  79.  
  80.