At 11:22 AM 12/10/2014, Albert Berry wrote:
I don't do things the hard way. I have the user select the printer ONCE
and store the value in the database until the user decides to use a
different printer for all the default printer functions. Then in the
report generation I put all the PRNSETUP commands that control the printer.
When the printer is changed, there is no code change involved. If the user
wants to use a different printer, he/she can select it. Please note that I
embed the PRNSETUP coding in the report. I don't use external code. Change
printers: no problem.
Automating the PRNSETUP command, especially in a network environment, and
having printer names with UNC path as well as installed printer names with
spaces, could be a challenge for novice R:BASE users/programmers/developers.
Here'a simple code that will allow users to select the appropriate printer
with exact path and exact printer name, even with spaces, etc.
-- Start here
-- Select Local/Network Installed Printer for Current R:BASE Session
-- Author: A. Razzak Memon
-- Date Created: December 10, 2014
-- Last Updated:
CLEAR VAR vAvailablePrinters,vItemCount,vSelectedPrinter
SET VAR vAvailablePrinters NOTE = NULL
SET VAR vItemCount INTEGER = NULL
SET VAR vAvailablePrinters = (CVAL('Printers'))
SET VAR vItemCount = (ITEMCNT(.vAvailablePrinters))
SET VAR vSelectedPrinter TEXT = NULL
CLS
CHOOSE vSelectedPrinter FROM #LIST .vAvailablePrinters +
TITLE 'Double-Click on Appropriate Printer to Select' +
CAPTION 'Available Printers' LINES .vItemCount FORMATTED +
OPTION LIST_FONT_COLOR BLACK +
|TITLE_FONT_COLOR BLACK +
|TITLE_FONT_NAME Tahoma +
|TITLE_FONT_SIZE 11 +
|LIST_BACK_COLOR [R234,G234,B234] +
|THEMENAME Longhorn
IF vSelectedPrinter IS NULL OR vSelectedPrinter = '[Esc]' THEN
GOTO Done
ENDIF
PRNSETUP .vSelectedPrinter
LABEL Done
CLEAR VAR vAvailablePrinters,vItemCount,vSelectedPrinter
RETURN
-- End here
Tip:
Use PRNSETUP INFO to find complete details about your current R:BASE
session printer.
Have fun!
Very Best R:egards,
Razzak.
www.rbase.com
www.facebook.com/rbase
--
31 years of continuous innovation!
16 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
--