6 Replies Latest reply on Feb 11, 2014 9:17 AM by flybynight

    Scripted print control


      I am not seeing how to control print options with a script. Is there a way to set wheter the print will do current record or browsed record via script?


      I find that the only reason I have to use the print dialog is to make this selection and sometimes users get it wrong and print large sets of things that is a waste of time and paper.


      I saw a plugin with a lot of print function control, but it seems like this should be able to be done natively.

        • 1. Re: Scripted print control

          Print Setup & Print Script Step should do the trick

          • 2. Re: Scripted print control

            Steve, I tried working with Print Setup but the documentation is horrible and mostly it talks about selecting a printer as well as paper size.


            Not much about how you specify printing only the current record, current found set, or all records.


            Printing in FM is a huge really full of problems starting with the weird zoom setting in preview mode. It would be nice to set that for each print as well. I could not figure that out either.


            Any help anyone has on print setup would be appreciated. I need to send certain print jobs to specific printers soon. I want to take away the ability for users to makee mistakes in the print settings in the dialog box.


            I will keep looking but there should be better info on the script steps available and what they do exactly.

            • 3. Re: Scripted print control

              The Print Setup and Print script steps do different things, and you need to use both to establish all the settings you need for particular purposes—page orientation and size, current record or found set, which printer to use and any specific settings for that printer, etc. Once you are sure you have them just as you want them you can set each of those script steps to perform without dialog. You may want to make more than one set of these steps for different purposes (current record or found set for example) and then control how these are applied by your users. this can be done in a number of ways:


              •     different print scripts that are called from different buttons or other controls

              •     branches within a script that are controlled via, say, script parameters


              If you do want to control all printing you will also need set up a custom menu and redirect the standard menu Print command to use your scripted print routine/s.


              And by the way, there is no printing optio that prints all records. If you want to do that you have to find all records first and then set printing of records being browsed (ie. the current found set).

              • 4. Re: Scripted print control

                Yes, I know Show All Records is just a found set of everything, but it is obviously traeted a litted different as it is a common found set. Hence we have Show all records and not a Find for all the record with a record ID.


                I think I figured this out. Between the two scripts most everything can be set. The Specify dialog box is a print dialog box and to aave the setting you need to click "Print" button which is not exactly intuitive since I did not need to actually print anything and the process confused me. I finaly took a chance and just clicked the button and everything was good.


                I guess it is just one of those FIlemaker things. For all the things I have accomplished with Filemaker I cant believe printing had me stumped for a bit.


                I have one layout that will go to the defualt printer and one that prints to a specific printer. I should not need a custom menu for that right. I can set everything with the print scripts on buttons within the layout, correct?

                • 5. Re: Scripted print control

                  Three things:


                  1.     From a printing point of view there is no special setting to print all records, just the options for current record only or all records being browsed.


                  2.     You are right, clicking the Print button when you are setting up your script is really just like saying "record those settings in my script".


                  3.     My point about a custom menu is that if a user chooses to print directly from the File menu –> Print (or its keyboard shortcut) instead of using your scripted button, then this will bypass your script entirely. If you want to prevent that from happening then you will need to create a custom menu, redirect that standard menu command to activate your script instead of its default behaviour, and make sure the custom menu is activate, at least on the layouts where you require this behaviour.


                  Hope that helps.

                  • 6. Re: Scripted print control

                    Another thing you can do to prevent users from printing things they shouldn't is just to turn off "Allow Printing" for that privilege set. For my main solution, I have that off, and only allow printing via buttons/scripts (script is set to run with Full Access Privileges, of course).


                    If you are setting things to print to specific printers, another problem you may run into is that each user needs to have the printers named the same on their system. If one user has a printer called "HP LaserJet 5000" and another user has the same printer on their computer, but named "Black and white main" then you could get things going to a wrong printer.


                    I found some odd behavior on Windows computers. I had my scripts defined on the Mac with a printer that the Windows users don't have access to. Just default 8.5x11" setups. On the Windows machines, they printed to the default printer, which is what I wanted. However, when that printer had a maintenance issue, I told the users to just switch their default printer to the temp one that they wanted to use. It kept sending to the old default printer, even after restarting FMP and restarting their computer. The only way to get it to actually change was to delete the old default printer. Then it printed to their new default. Once the old default printer was fixed, we had to repeat the process (delete the temp printer from their system) to force it to switch back to their original default.


                    There is a lot that you can do, but it involves managing a lot of different script steps with different settings saved in them. Printing (and particularly scripted printing) in FMP could be made more user/developer friendly, IMO. But with the focus heading towards things like WebDirect, I'm guessing that printing will get less and less attention.