home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / gwbasic / thinkjet / thinkjet.bas next >
Encoding:
BASIC Source File  |  1991-05-22  |  3.5 KB  |  75 lines

  1. 100 'The following program, written in HP150 GW-BASIC, provides the
  2. 110 'user with several menu choices for sending escape sequences to
  3. 120 'the THINKJET.  One menu choice permits you to stay in BASIC and
  4. 130 'either modify the program or use GWBASIC's Direct Mode to send
  5. 140 'additional escape sequences not on the menu to the printer.
  6. 150 WIDTH 80
  7. 160 ESC$=CHR$(27)
  8. 170 PRNTR$="PRN"  'Select printer
  9. 180 REM
  10. 190 'The following writes the printer control menu to the screen
  11. 200 'and requests a user response
  12. 210 PRINT
  13. 220 PRINT
  14. 230 PRINT "                 "+DATE$+"  "+TIME$
  15. 240 PRINT
  16. 250 PRINT "            Thinkjet Printer Control Menu  "
  17. 260 PRINT "           ******************************* "
  18. 270 PRINT
  19. 280 PRINT " 1 = NORMAL Print, 80 cpl      ";
  20. 290 PRINT " 2 = COMPRESSED Print, 142 cpl "
  21. 300 PRINT " 3 = EXPANDED Print, 40 cpl    ";
  22. 310 PRINT " 4 = EXPANDED-COMPRESSED Print, 71 cpl "
  23. 320 PRINT " 5 = BOLD Print On             ";
  24. 330 PRINT " 6 = Bold Print Off "
  25. 340 PRINT " 7 = PERFORATION Skip On       ";
  26. 350 PRINT " 8 = Perforation Skip Off "
  27. 360 PRINT " 9 = UNDERLINE On              ";
  28. 370 PRINT "10 = Underline Off "
  29. 380 PRINT "11 = 6 LPI  [default]          ";
  30. 390 PRINT "12 = 8 LPI  (8 lines per inch) "
  31. 400 PRINT "13 = End of Line WRAP-AROUND   ";
  32. 410 PRINT "14 = Without Wrap-Around "
  33. 420 PRINT
  34. 430 PRINT " S = Printer SELF-TEST         ";
  35. 440 PRINT " R = RESET printer to DEFAULTS "
  36. 450 PRINT " B = BREAK (Stay in BASIC)     ";
  37. 460 PRINT " M = redisplay MENU "
  38. 470 PRINT "         E or Q = QUIT/Return to DOS or MENU"
  39. 480 PRINT
  40. 490 PRINT "Enter 1 thru 14, S, R, B, E, M, or Q => ";
  41. 500 INPUT " ",B$
  42. 510 'Menu Actions
  43. 520 IF B$="B" OR B$="b" THEN STOP  'Stop program execution, stay in BASIC
  44. 530 IF B$="Q" OR B$="q" THEN GOTO 830 'Quit, return to MENU or DOS
  45. 540 IF B$="E" OR B$="e" THEN GOTO 830 'Quit, return to MENU or DOS
  46. 550 IF B$="0" THEN GOTO 830           'Quit, return to MENU or DOS
  47. 560 IF B$="M" OR B$="m" THEN GOTO 210 'Redisplay Thinkjet Menu selections
  48. 570 OPEN "O",#1,PRNTR$  'Directs output to printer selected above
  49. 580 IF B$="R" OR B$="r" THEN PRINT#1,ESC$+"E"; 'Reset printer to defaults
  50. 590 IF B$="S" OR B$="s" THEN PRINT#1,ESC$+"z"; 'Print Self-Test
  51. 600 IF B$="1" THEN PRINT#1,ESC$+"&k0S";  'Set Normal Print
  52. 610 IF B$="2" THEN PRINT#1,ESC$+"&k2S";  'Set Compressed Print
  53. 620 IF B$="3" THEN PRINT#1,ESC$+"&k1S";  'Set Expanded Print
  54. 630 IF B$="4" THEN PRINT#1,ESC$+"&k3S";  'Set Expanded-Compressed Print
  55. 640 IF B$="5" THEN PRINT#1,ESC$+"(s1B";  'Set Bold Print on
  56. 650 IF B$="6" THEN PRINT#1,ESC$+"(s0B";  'Set Bold Print off
  57. 660 IF B$="7" THEN PRINT#1,ESC$+"&l1L";  'Set Perforation Skip on
  58. 670 IF B$="8" THEN PRINT#1,ESC$+"&l0L";  'Set Perforation Skip off
  59. 680 IF B$="9" THEN PRINT#1,ESC$+"&dD";   'Set Underline on
  60. 690 IF B$="10" THEN PRINT#1,ESC$+"&d@";  'Set Underline off
  61. 700 IF B$="11" THEN PRINT#1,ESC$+"&l6D"; 'Set 6 lpi
  62. 710 IF B$="12" THEN PRINT#1,ESC$+"&l8D"; 'Set 8 lpi
  63. 720 IF B$="13" THEN PRINT#1,ESC$+"&s0C"; 'Set Wrap-Around on
  64. 730 IF B$="14" THEN PRINT#1,ESC$+"&s1C"; 'Set Wrap-Around off
  65. 740 CLOSE #1
  66. 750 IF B$="1" OR B$="2" OR B$="3" OR B$="4" THEN GOTO 810 'Close Printer
  67. 760 IF B$="5" OR B$="6" OR B$="7" OR B$="8" THEN GOTO 810 'Close Printer
  68. 770 IF B$="9" OR B$="10" OR B$="11" OR B$="12" THEN GOTO 810
  69. 780 IF B$="13" OR B$="14" OR B$="S" OR B$="s" THEN GOTO 810
  70. 790 IF B$="R" OR B$="r" THEN GOTO 810
  71. 800 GOTO 210                            'Re-display Menu
  72. 810 PRINT "ok"
  73. 820 GOTO 490
  74. 830 SYSTEM
  75.