The printer statement controls the output from subsequent print, heading, footing, or page statements.
printer [on|off|close|num.exp]
on | Directs output to the system printer, via the spooler. | |
off | Directs output from subsequent print statements to the terminal. | |
close | Indicates that the current (printer) output is completed. This closes all open spooler entries generated by the current process, and releases control of the print jobs to the spooler. printer close is implicit when the FlashBASIC or BASIC program stops and returns to TCL, or the calling Proc or executing program. | |
num.exp | Evaluates as follows: | |
-1 | Printer close. | |
0 | Printer off. | |
>=1 | Printer on. |
Example 1
In this example, the first string displays, print output is turned on, and the second string is sent to the spooler.
print ’press Enter to begin printing’ printer on print ’this is the first line’
The printer is turned on if the variable answer is the letter y.
crt ’print? ’:;input answer printer (answer=’y’)
This section turns off the printer to display an error message and prompt for operator intervention. When the printer is turned back on, output is appended to the currently open spooler file.
printer on print rec<5> if rec<6>=’’ then printer off print ’error in attribute 6’ print ’press Enter to continue ’: input continue printer on end
Example 2
In this example, a single section of a larger program sends output to the spooler, closes the job when finished, and continues execution of the program.
10 * print ’do you want to print? ’: input ans if ans # ’y’ then stop printer on print ’the amount is ’:amount print... ... printer close printer off goto 10