1 Reply Latest reply on Mar 23, 2009 8:52 AM by philmodjunk

    Scripting to Print Records Being Browsed then Reset to Print Current Record



      Scripting to Print Records Being Browsed then Reset to Print Current Record


      I'm setting up a program for others in our office to use and trying to keep it as idiot proof as possible through the use of scripts. They will be using Windows FMP10 runtime versions. They will normally be creating and printing single records, but on occasion they will be printing a list of several selected records. The main problem they have had in the past is remembering to switch the print setting between Print Current Record and Print Records Being Browsed, depending on the the document they are printing.


      The core question is: is there any way to set or retain in a script a Print without dialog, the Print (Current Record) or (Records Being Browsed) setting without actually printing?


      I've created a script to automatically go the "list" layout and to print without the print dialog, "Print Records Being Browsed" then return to the originating layout. This part works great, but it leaves the "print" dialog set to "Print Records Being Browsed" where I want it to revert back to "Print Current Record". I can't seem to find a way to change this setting without inserting another Print (without dialog) and presetting it to print only the current record. This would work, but it actually has to print that single record to retain that setting. I've also tried to run a script line that would print to the Current Record, but to a range greater that page 1. This works and doesn't print the record, but retains the print range in the print dialog for subsequent printing sessions.


      I can create a print script for the single Letter (print current record), but it can't be without going through the print dialog because they sometimes print to paper and other times print to a PDF printer.

        • 1. Re: Scripting to Print Records Being Browsed then Reset to Print Current Record

          Here's a simple work-around I've used for years that may work for you.


          Set your system to ALWAYS print with records being browsed.

          In situations where the user needs to print the current record, manipulate the found set to contain only a single record.

          Give users a Print/Preview button that switches to preview mode and pauses. If the user likes what they see, they can choose print from the file menu. If they don't they can continue the script to return to browse mode.


          Here's how I quickly isolate the current record for printing:


          Define a serial number field that uniquely identifies each record

          Define a relationship that self joins the table to itself using this field as the match field.

          Just before printing or previewing, use go to related record and this relationship to isolate the current record in 1 record found set.

          After the user finishes the preview I can restore the found set by performing a find or using Go To Related record and a different relationship.


          I can't guarantee this will work in your situation, as there are obvious trade offs.