Printing – Obsolete Ways
Clipper Language is a masterpiece of simplicity: almost all program output may realize with a single command : ‘?’; yes, question mark, aka PRINT command.
Unless otherwise stated, this command write everything ( included an empty line ) to the CONSOLE, that is screen / monitor. For writing to printer all we need was simply issue SET PRINTER ON command before ‘?’.
So simplest Clipper program to attempt print may be like this :
SET PRINTER ON
? “This is a line”
And now, this program doesn’t work as expected :
Error TERM/2014 Create error: LPT1 (DOS Error 2)
What are happening ?
The happening is clear : our program attempt to use LPT1 and our system doesn’t have LPT1, our printer is connected via USB port, same as all modern systems.
If you are thinking “I have LPT1” or “I can add a LPT1 card or an adapter to my system”; I have a bad news to you: problem isn’t only LPT1 / USB 😦
Whereas this layout :
SET CONSOLE OFF SET PRINTER ON GO TOP DO WHILE .NOT. EOF() ? <FIELD1>, <FIELD2>, <FIELD31>, ... SKIP ENDDO
SET PRINTER OFF SET CONSOLE ON
was a standard statement block in almost all Clipper program using Printer.
Second printing way was using @ …, … command instead of ‘?’ :
SET DEVICE TO PRINTER @ 2, 0 SAY "This is a line" SET DEVICE TO SCREEN
Full layout of this method may be like this :
USE Salesman INDEX Salesman NEW SET DEVICE TO PRINTER DO WHILE !EOF() // Print all records @ 2, 5 SAY RTRIM(FirstName) + ", " + LastName @ 3, 5 SAY Street @ 4, 5 SAY RTRIM(City) + ", " + State + " " + ; PostalCode @ 6, 0 SAY SPACE(1) // Move to label bottom SETPRC(0, 0) // Suppress page eject SKIP // Next record ENDDO SET DEVICE TO SCREEN CLOSE Salesman
The result not changed :
Error TERM/2014 Create error: LPT1 (DOS Error 2)
We have another way to printing :
– First send lines to a intermadiate file instead of printer
– And than send that file to printer
If you don’t want to change your printing habits, there is a easy way to you: use a external program such as DosPrint or another else. Run this program / wizard before yours, this program will send all your old style print-outs to the modern printer by ways that Windows required.
If this way satisfactory to you, don’t read remaining of this “Printing” issue and as a programmer, continue using third party products for supporting your own program.
Pingback: HMG Samples | Viva Clipper !
Pingback: How I can print | Viva Clipper !