mario@wjvax.UUCP (Mario Dona) (05/31/89)
I've seen lots of interest in the HP printer, so I decided to post something I got from PC magazine awhile back (Sept. 15, 1987 to be exact). I don't think its copyrighted since they usually allow free distribution of their other utilities. You obviously need BASICA to run it, although I guess it would also work with GWBASIC (I haven't tried that); you also need the laser printer User's Manual. This nifty program creates .COM files that control the printer's configuration. It's a time saver for me; since I don't have a laser printer hooked up directly to my PC, I take my disk over to someone who does, send the .COM file I created, then send the print file. Enjoy. --------snip--------------snip--------------snip--------------snip---------- 100 'PRCODER.BAS -- creates printer control .COM files 105 'ORIGINAL SOURCE: PC MAGAZINE SEPT. 15, 1987 110 DIM Z$(20):K=1:U$=CHR$(30)+STRING$(64,32)+STRING$(64,29) 120 KEY 9,"":KEY 10,"":DEF FNST$(Y)=MID$(STR$(Y),2+(Y<0)) 130 BAD$=".,\+*?^[]=;:<>"+CHR$(34):KEY OFF:CLS 140 ' === name the file === 150 INPUT "Enter 8-character name (WITHOUT EXTENSION): ",N$ 160 IF N$="" OR LEN(N$) > 8 THEN CLS: GOTO 150 170 FOR A=1 TO LEN(N$) 180 IF INSTR(BAD$,MID$(N$,A,1)) <> 0 THEN CLS: GOTO 150 190 NEXT:N$=N$+".COM":CLS 200 ' === print instructions ==== 210 PRINT "Enter codes to send to you printer. "; 220 PRINT "Hit actual keys -- like <ESC> or A or 5 " 230 PRINT "OR -- hit F9 then type a THREE-digit "; 240 PRINT "decimal ASCII code, e.g. <F9>255 or <F9>007" 250 PRINT "Enter up to 20. Backspace fixes errors. "; 260 PRINT "After the last one, hit <F10> to quit." 270 ' === main loop === 280 I$=INKEY$:IF I$="" THEN 280 290 IF I$ <> CHR$(8) THEN 310 300 IF K<2 THEN 200 ELSE PRINT U$;:Z$(K)="" :K=K-1 : GOTO 280 310 IF I$=CHR$(0)+CHR$(67) THEN 440 320 IF I$=CHR$(0)+CHR$(68) THEN IF K > 1 THEN 570 330 IF LEN(I$) > 1 THEN 280 340 IF I$=CHR$(27) THEN P$="<ESC>" 350 IF I$=CHR$(13) THEN P$="<ENTER>" 360 IF P$="" THEN P$="CHR$("+FNST$(ASC(I$))+")" 370 PRINT P$; :P$="" 380 ' === display it and fill array === 390 IF ASC(I$) > 32 THEN PRINT TAB(13); "[";I$;"]" 400 IF K<20 THEN PRINT TAB(20); "(Enter up to ";20-K;" more"; 410 PRINT "-- or hit <F10> to quit" 420 Z$(K)=I$:K=K+1:IF K=21 THEN CLS: GOTO 570 ELSE 280 430 ' === direct entry === 440 PRINT "CHR$("; 450 J$=INKEY$:IF J$="" THEN 450 460 IF J$=CHR$(13) AND C$ <> "" THEN PRINT ")"; : GOTO 550 470 IF J$ <> CHR$(8) OR C$="" THEN 500 480 C$=LEFT$(C$, LEN(C$)-1) 490 PRINT CHR$(29); CHR$(32); CHR$(29); : GOTO 450 500 IF INSTR("0123456789" , J$) = 0 THEN 450 510 C$=C$+J$: IF VAL(C$) < 256 THEN 540 ELSE S=LEN(C$)-1 520 PRINT STRING$(S,29);STRING$(S,32); STRING$(S,29); 530 C$="": GOTO450 540 PRINT J$;: IF LEN(C$) < 3 THEN 450 ELSE PRINT ")"; 550 I$=CHR$(VAL(C$)) : C$="": GOTO 300 560 ' === program creation === 570 OPEN N$ AS #1 LEN=1: FIELD #1,1 AS D$: FOR A=1 TO K-1 580 LSET D$=CHR$(178):PUT #1: LSET D$=Z$(A): PUT #1 590 LSET D$=CHR$(180):PUT #1: LSET D$=CHR$(5): PUT #1 600 LSET D$=CHR$(205): PUT #1: LSET D$=CHR$(33): PUT #1 610 NEXT : LSET D$=CHR$(195): PUT #1: CLOSE: PRINT N$ " CREATED"; 620 SYSTEM .........snip...............snip...............snip...............snip...... Mario Dona ...!{ !decwrl!qubix, ames!oliveb!tymix, pyramid}!wjvax!mario The above opinions are mine alone and not, in any way, those of WJ.