Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting selected printer info...
Message
From
11/10/2002 08:11:28
 
 
To
11/10/2002 00:01:57
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00710183
Message ID:
00710234
Views:
13
>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.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform