Getting a list of printers
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Getting a list of printers
You can use the GET-PRINTERS option of
the SESSION statement to obtain a list of the printers configured
for the current system. The i-wgetls.p procedure shows
you how to obtain the list of currently configured printers, select
a printer, and print to it:
i-wgetls.p
|
The following list explains the important elements in i-wgetls.p:
- Create two variables: one for the output of
SESSION:GET–PRINTERS; the other, for the output ofLOOKUP. - The
SESSION:GET–PRINTERSmethod returns a comma-separated list of printers that are currently configured on the system. - The
LOOKUPfunction obtains an integer that gives the position of "SpecialPrinter" in the list. If the printer is not in the list, it returns a 0. - The
IFstatement determines whether the printer "SpecialPrinter" is available and if so, prints to it. - If the printer "SpecialPrinter" is not available, the
ELSE DOstatement prints to the default printer. - The
OUTPUT CLOSEstatement stops sending output to the current destination and redirects output to the destination used prior toOUTPUT TO. See Stream I/O vs. screen I/O for more information.