5 Replies Latest reply on Jan 28, 2012 9:20 AM by todor

    Print Script Options

    coloradokid

      Can anyone tell me if there is a way to tell FileMaker how many copies I want through a script. By grabbing a number from a number field?

        • 1. Re: Print Script Options
          todor

          If we have a database with two global number fields "n_copy" for the number of copies needed and a counter "n" we can use a script like this:

           

          Go to Layout [ the layout that you want to print ]

          Show Custom Dialog [ Title: "Number of copies"; Message: ; Buttons: "OK", "Cancel", ""; Input #1: n_copy, "" ]

          If [ Status( CurrentMode) = 2 ]

             Go to Layout [ original layout ]

             Halt Script

          End If

          If [ n_copy <= 0 ]

            Go to Layout [ original layout ]

            Halt Script

          End If

          Set Field [ n, 1 ]

          Loop

             Print [ No dialog ]

             Exit Loop If [ n = n_copy ]

             Set Field [ n, n+1 ]

          End Loop

          Go to Layout [ original layout ]

           

           

          The script ask for the number of copies needed. If the user provide a strict positive number then a number of copies equal with this number will be printed. If the user provide a negative number, a zero or pushes "escape" nothing wil happen.

          If by mistake an extremly high number is provided the time to process the script could be prohibited so a superior limit could be checked.

          The script is working since version 6.

          • 2. Re: Print Script Options
            coloradokid

            Thanks Todor, I as afraid this was going to be the answer. I was hoping the was a way to insert number directly into the print dialog box but maybe someday. It just seams so cumbersome to do it this way especially if you have 8 forms that you may want to print as many as 60 copy's. But I do appreciate you taking the time to answer me.

            • 3. Re: Print Script Options
              timwhisenant

              Coloradokid (would address you by name but alas you did not sign your post),

               

               

               

              Why not use a custom dialog to get the number? Or have a defaults table and have the script read the default number? In either case set the printing loop to follow and there you have it n copies. I personally use a custom dialog to accomplish this.

               

               

               

              Tim

               

               

               

              Timothy R Whisenant

               

              Plastic Fusion Fabricators, Inc.

              • 4. Re: Print Script Options

                Todor,

                 

                There is a potential your script may crash if you exceed a certain number of pages (about 20 to 40) if you print that way.

                Please read  ]

                If

                    Loop

                        Print

                        Set Variable

                        Exit Loop If [ $n < 1 ]

                    End Loop

                End If

                Go to Layout

                 

                 

                Remember that one print job per page takes significantly longer to print than specifying the number of pages for one print job.

                 

                 

                 

                Winfried

                • 5. Re: Print Script Options
                  todor

                  If there are many layouts to print we can change the line

                   

                  Show Custom Dialog [ Title: "Number of copies"; Message: ; Buttons: "OK", "Cancel", ""; Input #1: n_copy, "" ]

                   

                  to ask the number of layout to print (field "n_layout" from below):

                   

                  Show Custom Dialog [ Title: "Number of copies, number of layout"; Message: ; Buttons: "OK", "Cancel", ""; Input #1: n_copy, ""; Input

                  #2: n_layout, "" ]

                  If [ not ( n_layout = 1 or n_layout = 2 or n_layout or n_layout = 3 or n_layout = 4 or n_layout = 5 or n_layout = 6 or n_layout = 7 or n_layout

                  = 8 ) ]

                     Halt Script

                  End If

                   

                  We added three lines in the scrip to check the number of layout to print. Of course numbers 1 to 8 can be put in accordance with the real number of script from your database.