10 Replies Latest reply on Feb 26, 2013 9:51 AM by Gingernut

    Specifying Print Options in Script

    MattLeach

      I'm coming across an issue when specifying print options on a script.

       

      A little information about our setup: We are all Windows based, running FileMaker Pro Advanced v11 with databases hosted on FileMaker Server Advanced v11.

       

      We have several reports and informational sheets that need to be printed from the database. On the script for each of these items, i have the 'Specify Print Options' box checked so that i can script whether a group of records need to be printed, or just the current record.

       

      The issues becomes that with this option selected, FileMaker will no longer utilize the default windows printer on the users local machine. Instead, it will use the printer specified when the script was setup.

       

      I contacted FileMaker and they confirmed this is the case and that there was no way to specify what to print (i.e. current record or records being browsed) without also specifying a printer. They went on to explain that FileMaker will look for the printer specified on the users local machine, and if it can't find it, it should then default to their defauls windows printer.

       

      So i went ahead and created a printer on my machine named "FileMaker Dummy Printer" and specified it in all of my scripts. After it was in the scripts, i deleted it from my machine, attempted a print job and it now defaults to my default printer. Great! But then another issue arises.

       

      When another user on another machine attempts the same print job (utilizing the same script), it defaults to my default printer, not theirs???

       

      Is there any way to have FileMaker ALWAYS utilize the default windows printer on the local machine, yet still give me the ability to specify whether to print for current record or records being browsed???

       

       

      Also -- FileMaker seems to have it's own idea of what your default printer is.

       

      For example: Lets say my default printer is printer1. I run my script, printer1 is the selected printer, all good and well. Now, if i change my default printer in windows to printer2, run the same script, printer1 is still the default.

      I exit out of FileMaker completely and come back in, still printer1.

      I've rebooted my machine, back into the database, still printer1.

       

      I went ahead and setup a closing script to Flush Cache to disk. Still printer1. IT seems that somewhere FileMaker remembers your original default printer. Would this have something to do with FileMaker Server possibly caching the printer?

        • 1. Re: Specifying Print Options in Script
          jose@solutionscay.com

          Hello mleach82,

           

          Regarding wether to print Current Record or All Records.

           

          You might want to try having a script called "Print ( current or all )." To which you pass the parameter "current" or "all" according to what you want to print. The code would look something like this:

           

          If Get ( ScriptParameter ) = "current"

             Print [ Current Record ]

          Else If Get ( ScriptParameter ) = "all"

             Print [ All Records ]

          End If

           

          I know this doesn't solve the issue of which printer to use. Why not leave the Print step with dialog and let the user choose their printer?

          • 2. Re: Specifying Print Options in Script
            MattLeach

            I like the idea of passing the parameter, but that will still specify a default printer in the script. The only way i can see for this to work would be to have the drop down for Current Record or All Records as a separate option all to itself.

             

            But...even if that were the case, i would still have the issue with FileMaker not recognizing the default windows printer correctly as explained in the 2nd half of my original post.

             

            I agree with letting them choose the printer, i wish it were that easy.

             

            Unfortunately their excuse is they are "too busy" to pay attention if the job is going to the printer they want and that the program should just utilize what is their default. I doubt that very much but unfortunately they are the ones in charge, not me.

            • 3. Re: Specifying Print Options in Script
              jose@solutionscay.com

              Hello mleach82,

               

              I'm not an expert with troubleshooting Print Setup issues in FileMaker. But I do know this is a pain for many developers. If anyone has experience with this I'm looking forward to read their posts.

               

              This is from the top of my head, could you set up individual print scripts for each of your users?

               

              This is ugly... For example

               

              If Get ( AccountName ) = "sally"

                  Perform Script [ Sally's Print Script ( current or all )

              Else If Get ( AccountName ) = "billy"

                 Perform Script [ Billy's Print Script ( current or all )

              End If

               

              Best,

               

              Jose

              • 4. Re: Specifying Print Options in Script
                MattLeach

                That's what i had in mind to do, but as you said it's a pain in the you know what. We have about 50 users and half of them use different printers.

                 

                May not be much of a pain if i go by their priviledge set, but nonetheless, still a pain.

                 

                I must say i'm kind of shocked that there is no workaround for this. My final answer from FileMaker was to use a 3rd party plugin.

                • 5. Re: Specifying Print Options in Script

                  We haven't dealt with settings for specific printers, but this could be solved by creating a staff table and a printer table and then assign a printer record to each staff person. Then you could pass their printer ID to your print script and let the print script handle the different Print script steps.

                   

                  It might also be worth looking into "Hands-Free Printer":

                  http://www.dracoventions.com/products/2empowerFM/family/print.php

                   

                  We have use a script called "Print Controller" that passes the following parameters. By passing parameters you can make your print script very smart!

                   

                  Param ( "ParamPrintType" ; "Print" ) & // Print, PDF or Preview, Default is Print

                  Param ( "ParamFolderPath" ; ParamValue ) &  // Optional - If no folder path is sent the file will be created in the FMSB temp folder

                  Param ( "ParamFileName" ; ParamValue ) & // Optional - If no name is provided the currrent timestamp will be used

                  Param ( "ParamPageSetup" ; "Letter Portrait" ) & // Letter Portrait, Letter Landscape, Legal Portrait, Legal Landscape, Tabloid Portrait, Tabloid Landscape

                  Param ( "ParamRecordSet" ; "Current" ) &  // Current or Browsed

                  Param ( "ParamNewWindow" ; "Yes" ) & // Yes or No, Yes is default

                  Param ( "ParamPreview" ; "Yes" ) & // Yes or No, Yes is default

                  Param ( "ParamDialog" ; "Yes" ) // Yes or No, Yes is default

                   

                  I hope this helps!

                   

                  Hal

                   

                  --

                   

                  Hal Gumbert  <hal@campsoftware.com> or <hal@mac.com> or <hal@me.com>

                  CampSoftware <http://www.campsoftware.com>

                  Office   407-282-5585 (EST)

                   

                  FileMaker Pro Database Development & Consulting

                  Holding Certifications in FileMaker Pro 11, 10, 9, 8, and 7

                   

                  Blog: <http://www.campsoftware.com/blog>

                  Blog Updates via Email: <http://campsoftware.com/newsletter>

                  Twitter: <http://twitter.com/halgumbert

                  • 6. Re: Specifying Print Options in Script
                    MattLeach

                    I will look into that. Thank you.

                     

                    Going back to the second part of my first post, anyone have any idea as to why FileMaker will not recognize the newly designated default printer?

                    • 7. Re: Specifying Print Options in Script

                      Matt,

                       

                      You may want to read <http://fmdiff.com/fm/printing.html>

                       

                       

                      Winfried

                      • 8. Re: Specifying Print Options in Script
                        MattLeach

                        I did read the first half of that article yesterday but did not finish it but i intended to today.

                         

                        It appears the only way to get FileMaker to see the new printer is to locate the reg key that stores the default printer and delete it.

                         

                        This is just one of those things that seems simple enough for FileMaker to do without the user having to modify the registry. Would be nice if there were an option to "Always use default printer", this would alleviate at least 2 problems.

                         

                        Thanks

                        • 9. Re: Specifying Print Options in Script
                          MattLeach

                          Just an update for anyone else who may need this, the reg key is"

                           

                          HKCU > Software > FileMaker > FileMaker Pro > [Version Number] > Preferences

                           

                          There is a 'Default Printer' key.

                          • 10. Re: Specifying Print Options in Script
                            Gingernut

                            Would you by any chance have a sample file with how the table of printers works and a sample print script?