home *** CD-ROM | disk | FTP | other *** search
- Program HPset;
- uses crt,dos,printer;
- type
- st80 = string[80];
-
- var
- e,null,ff,HPreset,HP8lpi,HP6lpi,HP16cpi,HP10cpi,HPland,HPport,HPmanu,HPleg,HPlet,HPauto : st80;
- history : st80;
- pick : char;
- done, gotit : boolean;
- IOcode : integer;
-
- FUNCTION PrinterReady(TimeOutSeconds : integer) : Boolean;
- {provided by Dan Strenczewilk on BORPRO forum (thanks, Dan)}
- VAR
- R : Registers;
- hour, min, sec, hun, StartTime, i : WORD;
- BEGIN
- GetTime(hour,min,sec,hun);
- StartTime := (min*60)+sec;
- REPEAT
- R.AX := $4407; { IOCTL function 7 - Get output status }
- R.BX := $0004; { standard Printer device handle }
- MsDos(R);
- i := IOresult;
- GetTime(hour,min,sec,hun);
- UNTIL ((R.Flags and fcarry = 0) AND (R.AL = $FF))
- or ((min*60)+sec-StartTime > TimeOutSeconds) or (i <> 0);
- PrinterReady := (R.Flags and fcarry = 0) and (r.AL = $FF) and (i = 0);
- END;
-
-
- BEGIN
-
- {Printer strings}
- e := CHR(27);
- null := CHR(0);
- ff := CHR(12);
-
- HPreset := null+e+'E'+e+'(8U'+e+'(s10h3T';
- HP8lpi := e+'&l8D';
- HP6lpi := e+'&l6D';
- HP16cpi := e+'(s16.66h0T';
- HP10cpi := e+'(s10h3T';
- HPland := e+'&l1O';
- HPport := e+'$l0O';
- HPmanu := e+'&l2H';
- HPleg := HPmanu+e+'&l1O'+e+'&l3A'+e+'(s16.66h0T'+e+'&l8D';
- HPlet := e+'&l2A';
- HPauto := e+'&l1H';
-
- writeln('Set up HP LaserJet');
- writeln;
- history:=' ';
- pick := '1';
- done := false;
- while not done do
- begin
- ClrScr;
- writeln;
- write(' ');
- TextColor(0);
- TextBackground(7);
- writeln ('S e t u p H P L a s e r J e t');
- TextColor(7);
- TextBackground(0);
- writeln;
- write ('Selected so far : ');
- write(history);
- writeln;
- writeln(' 1: Reset Printer');
- writeln(' 2: 8 lines per inch - (close spacing)');
- writeln(' 3: 6 lines per inch - (normal spacing)');
- writeln(' 4: 16 chars. per in. - condensed, LinePrinter');
- writeln(' 5: 10 chars. per in. - normal Courier');
- writeln(' 6: Landscape - sideways');
- writeln(' 7: Portrait - upright' );
- writeln(' 8: Legal paper, manual, landscape, condensed, 8 li./in.');
- writeln(' 9: Letter paper');
- writeln(' A: Manual Feed');
- writeln(' B: Auto Feed');
- writeln(' T: Test');
- writeln(' F: Form Feed - eject page');
- writeln(' 0 or Esc: QUIT');
- writeln;
- write('>> ');
- gotit := false;
- while not gotit do
- begin
- pick := UpCase(ReadKey);
- case pick of
- #27 : halt;
- '0' : halt;
- end;
- if pick in ['1','2','3','4','5','6','7','8','9','A','B','F','T'] then gotit := true;
- end;
-
- if printerready(2) = false then
- begin
- writeln(chr(7), 'PRINTER ERROR - PRINTER NOT ON-LINE!!!');
- halt;
- end;
- case pick of
- '1': begin
- write(lst,HPreset);
- history := pick;
- end;
- '2': begin
- write(lst,HP8lpi);
- history := history+' '+pick;
- end;
- '3': begin
- write(lst,HP6lpi);
- history := history+' '+pick;
- end;
- '4': begin
- write(lst,HP16cpi);
- history := history+' '+pick;
- end;
- '5': begin
- write(lst,HP10cpi);
- history := history+' '+pick;
- end;
- '6': begin
- write(lst,HPland);
- history := history+' '+pick;
- end;
- '7':begin
- write(lst,HPport);
- history := history+' '+pick;
- end;
- '8': begin
- write(lst,HPleg);
- history := history+' '+pick;
- end;
- '9': begin
- write(lst,HPlet);
- history := history+' '+pick;
- end;
- 'A': begin
- write(lst,HPmanu);
- history := history+' '+pick;
- end;
- 'B': begin
- write(lst,HPauto);
- history := history+' '+pick;
- end;
- 'T': begin
- write(lst,'This is a test of the state of the printer.');
- writeln(lst);
- writeln(lst,'Selections so far: '+history);
- history := history+' '+pick;
- writeln(lst);
- end;
- 'F': begin
- write(lst,ff);
- history := history+' '+pick;
- end;
- end;
-
- end;
- END.
-