Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any Work around for Set Printer to Name command
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00932252
Message ID:
00933520
Views:
22
>Hi Mark,
>
>The Line of Code that fails is "Set print to Name ".
>Below is my code to open the cash drawer.
>
Set device to print
>Set print to name "STAR" ==> Line of Code Fails
>/


Then we need to concentrate on this line of code. What is the error message? My guess is the printer name "STAR" does not exist. What you should do is make your code generic. Maybe a configuration option where the user can select and save the printer to use for printing the receipts. Then you store that selection in a table that identifies that user and that workstation as using that printer for the receipt printer.

Use the GETPRINTER() function to get the printer name. If the user clicks the Cancel button on the printer selection dialogue, the return value will be empty. If a printer had not previously been selected, you could keep prompting them until they select a printer.

You can use SYS(0) to get the machine name and user login ID. Then store the printer name selected, the machine name and login ID in a configuration table. Now you are not hard-coding a printer name in your code. Some users might install this printer using a slightly different name, like "Star Printer" or "Star".
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform