>My users can print a series of reports (up to 40) and I use 'prompt' to call the standard print dialog in the first report. If the user changes printers in the dialog (or selects copies >1), it reverts to the previous (default) printer. I would like to capture these values and use them in subsequent report(s) without calling the dialog again and again and again... and I'm not interested writing my own dialog.
>An expression like
>prnname=set("printer",2 (or 3))
>set printer to name (prnname)
>on the report doesn't work.
>
>Is there a solution out there?
Rather than use the PROMPT clause, get the printer name via one of the native VFP commands like SYS(1037) and save it - switch to that printer using SET PRINTER TO NAME (whatever) before invoking your report. Make cerain that the FRX has had the Expr, Atg and Tag2 fields cleared out so that no printer information that would interfere with the use of the VFP-selected printer is in use; after printing, a SET PRINTER TO would reset the VFP printer.
You can also use something like the WSH Wscript.Network object to switch WIndows default printers selected by GETPRINTER() or APRINTERS() using the SETDefaultPrinter method. This is discussed in the 5 part article that George Tasker and I wrote for VFUG a couplke of years ago; a link to it is available from the articles section of UT, and there has been plenty of recent discussion of this here on UT, too, so search the last month's messages - you can look at my message posts for the previous month, and I'm sure I've posted sample code a few times.