At 08:56 PM 8/5/2005, Philippe Gosselin wrote:
I've tried the code below & it didn't work! I still print to the default
windows printer!
Why can't we just issue a PRNSETUP, select the printer and options from
the menu & print rptname OPTION PRINTER? Wouldn't it be simpler?
Philippe,
I have tried the following code (see below) on my end and all seems to
work accordingly.
To debug the process on your end:
01. TRACE the code, select the appropriate printer, and right after the
"PRNSETUP .vSelectedPrinterand" command intercept/close the TRACE.
02. At the R> prompt, type PRNSETUP
Notice the selected printer. This should be the exact printer as
selected from the available list of printer in CHOOSE options.
If that is not the case on your end, then you need to submit all details
including the exact version and build, operating system to:
http://www.rbase.com/rbg7rdcc
-- start
-- PickPrinterAndPrintReport.RMD
-- Author: A. Razzak Memon
CLEAR VAR vAvailablePrinters,vItemCount,vDefaultPrinter,vSelectedPrinter
SET VAR vAvailablePrinters TEXT = NULL
SET VAR vItemCount INTEGER = NULL
SET VAR vDefaultPrinter TEXT = NULL
SET VAR vAvailablePrinters = ((CVAL('Printers'))+',Screen')
SET VAR vItemCount = (ITEMCNT(.vAvailablePrinters))
SET VAR vDefaultPrinter = (CVAL('WindowsPrinter'))
SET VAR vSelectedPrinter TEXT = NULL
CLS
CHOOSE vSelectedPrinter FROM #LIST .vAvailablePrinters +
CHKBOX 1 TITLE 'Select Appropriate Printer' +
CAPTION 'Available Printers' LINES .vItemCount FORMATTED +
OPTION LIST_FONT_COLOR WHITE +
|LIST_BACK_COLOR TEAL +
|TITLE_FONT_COLOR RED +
|TITLE_BACK_COLOR WHITE +
|WINDOW_BACK_COLOR WHITE +
|TITLE_FONT_NAME VERDANA +
|TITLE_FONT_SIZE 9 +
|TITLE_BOLD ON +
|WINDOW_CAPTION +
|BUTTONS_BACK_COLOR WHITE +
|BUTTONS_SHOW_GLYPH ON
IF vSelectedPrinter IS NULL OR vSelectedPrinter = '[Esc]' THEN
GOTO Done
ENDIF
IF vSelectedPrinter = 'Screen' THEN
PRINT reportname WHERE .. ORDER BY .. +
OPTION SCREEN|WINDOW_STATE MAXIMIZED
GOTO Done
ELSE
PRNSETUP .vSelectedPrinter
PRINT reportname WHERE .. ORDER BY .. OPTION PRINTER
PRNSETUP .vDefaultPrinter
ENDIF
LABEL Done
CLEAR VAR vAvailablePrinters,vItemCount,vDefaultPrinter,vSelectedPrinter
RETURN
-- end
Hope that helps!
Very Best R:egards,
Razzak.