12 Replies Latest reply on Jan 7, 2010 4:39 AM by bsternberg

    Select Printer through Scripting?

    bsternberg

      Title

      Select Printer through Scripting?

      Post

      I've designed a point-of-sale system for my business that is working very well. We have a combination of retail as well as commercial customers. For a retail sale, I print a receipt on a POS printer. For commercial customers, I print a full size invoice on a laser printer.

      Is there any way to specify which printer is used automatically so we can avoid opening the print dialog box to choose the correct printer?

        • 1. Re: Select Printer through Scripting?
          philmodjunk
            

          Either of these two steps may be used in a script to select a printer:

           

          Print[restore]

          Print Setup [restore]

           

          When you define the script, click the Specify... button to select printer options, including the desired printer and the selected printer. Click the Perform Without Dialog option to print to the selected printer without popping up the dialog.

          • 2. Re: Select Printer through Scripting?
            bsternberg
               I've tried using both approaches without success. I'll try again and post the results on Monday. Thanks for your response!
            • 3. Re: Select Printer through Scripting?
              bsternberg
                

              FINALLY got a chance to try it using the print command. Worked like a charm! Don't know why I've had a problem in the past.

               

              Thanks! 

              • 4. Re: Select Printer through Scripting?
                RickWhitelaw
                  

                PhilModJunk wrote: 

                 

                "Either of these two steps may be used in a script to select a printer:

                 

                Print[restore]

                Print Setup [restore]"

                 

                Yes, I use these steps all the time but realizing they only work on MY setup. Another user will likely have different printers. To truly script printer selection at this time (unfortunately and inexplicably?) a plugin is needed. This post doesn't aim to deprecate your suggestion but to point out an obvious lack in FM.

                 

                RW 

                • 5. Re: Select Printer through Scripting?
                  philmodjunk
                    

                  A very good point to add to this thread. This is a well known and often complained about limitation to Filemaker databases. I've previously suggested via the suggest a new feature form that filemaker at least add some kind of "default printer" option to better control what printer is selected. That doesn't solve all the problems, but it would help.

                   

                  I often avoid the issue by not using a print script step at all. Instead, I simply preview the report and pause for the user to either continue the script without printing or to select print from the File menu--an operation that's a familiar step to the user since they do this all the time with other apps. It's not a perfect solution as I may need to educate them on the difference between "records being browsed" and "current record" options, but it simplifies matters a lot in many situations.

                  • 6. Re: Select Printer through Scripting?
                    RickWhitelaw
                      

                    Even a simple Get function that returned a list of available printers as text separated by carriage returns would do the trick. It would then be possible to match "tasks" with printers in a preferences table. I have one printer used for cheques and another for most everything else. It's quite simple to script which printer does which task. However, if I ever allow this particular solution into the hands of others, all that code would need to be trashed and the users would be presented with the dialogs once again.

                     

                    RW 

                    • 7. Re: Select Printer through Scripting?
                      HugoLidia
                         Can't you use Filemaker's inbuilt PDF print facility.  The resulting PDF can then be printed on any printer?
                      • 8. Re: Select Printer through Scripting?
                        philmodjunk
                           Of course, though I think many users would find the additional step a bit of an inconvenience. Still, it would work and may be the better option in many circumstances.
                        • 9. Re: Select Printer through Scripting?
                          bsternberg
                            

                           

                          "Can't you use Filemaker's inbuilt PDF print facility.  The resulting PDF can then be printed on any printer?"

                           

                          That's true, but I was trying to implement one click printing for a POS receipt. I want my salespeople to be as efficient as possible while making a sale. That means the fewer mouse clicks and keystrokes, the better.

                           

                          If and when we have to replace our printers, I will have to open the printing script and select the new printer. An easy task for me, but if I'm not around my employees will have to go back to managing the print dialog box. I do like the idea of a Get function to retrieve the list of connected printers. 

                          • 10. Re: Select Printer through Scripting?
                            philmodjunk
                              

                            I've been able to use the straight Print[] (no restore) to print to the correct printer. Due to custom page size issues, our cashiers open print set up each morning after they open the DB and select both printer and custom page size. (The custom page size is the option that doesn't "stick" with the restored printer option.)

                             

                            Since they don't print to any other printer until they are ready to cash out at the end of the day, they can make this choice once at the start and then the script prints correctly to the desired printer from a single mouse click from that point on.

                            • 11. Re: Select Printer through Scripting?
                              RickWhitelaw
                                

                              On Mac OS you can set the Default printer to "last printer used" so the straight print step would default to that. As long as the user remembers to change to another printer to print labels, cheques or whatever and then remembers to change back . . . . I set one printer as my Default printer and print cheques with another that's loaded with cheques. If I didn't use complete Print steps, one day I would forget to change printers and find I've printed out fifty pages on (relatively) expensive pre-printed cheques. If FM can have "Get(PrinterName)" which returns the name of the default printer as a text string, it seems like a short way to go to return a list. Each print script could reference a printing preference table that would match tasks i.e "labels, cheques, general, etc." with a printer name. It seems like a straightforward matter. On the other hand, if it were, I'd have found a way to write it by now. Perhaps it's time for me to get more familiar with x-code tools.

                                Of course my main beef about all this is simple: a person can set up very elegant routines to automate printing tasks but the routines are not really transferable to another workstation. The option of purchasing and licensing  a plugin is available but I feel strongly that this situation (multiple printers), which although not universal, is very common, and that FM should make this work without a plugin. It just seems like a "meat and potatoes" issue for a database platform. Most solutions call for specialized printing scenarios and it would be nice to be able to automate them in a way that's universal.

                              • 12. Re: Select Printer through Scripting?
                                bsternberg
                                   We switch back and forth between a receipt printer and a Ricoh laser printer for invoices. The Ricoh has a setting in its driver to not use the last page size selected, so switching between the two printers has not been an issue. (Took us a while to find the solution.)