5 Replies Latest reply on Aug 13, 2011 7:22 AM by Tbear

    Script Help Request (Save As PDF)



      Script Help Request (Save As PDF)


      I want to Script a "Save As PDF" button on an Invoice (report form) layout that ultimately gets emailed to customers so that I have a copy in another folder on my PC of all invoices sent.

      I know how to specify the path into the right folder but I need to give each PDF a different name (customer's name/date) and I can't figure out how to make the script stop at the Windows dialog box that allows one to name the new file before it saves it.

      Thanks to the help I got I have now been able to come up with the correct script and all is well except for one thing that may not even be a FMP 11 issue. When I go to the folder that contains all my saved PDF's and I try to open one, Windows makes me choose the program (which is Adobe of course) and it won't let me check the box for "Always open this type of file with this program". If I just do a non-script "Save As PDF" the files open right up without having to choose a program. What could be causing this little problem?

      NEVER MIND - I forgot to add ".pdf" to the $Filename variable calculation. 

        • 1. Re: Script Help Request (Save As PDF)

          If you enable the dialog on the save as PDF, you have to select the location as well as specify the name. And you can't capture that info in a variable to use with the Send Mail step.

          You might consider using a custom dialog with an input field to get the file name, then use the value from this field as part of the calculation that produces the file path and puts it in a variable for use with Save as PDF and Send Mail.

          • 2. Re: Script Help Request (Save As PDF)

            The first part of the answer is what I was afraid you would say and what I didn't see any way around using the script step for Save As PDF.

            The second part would probably work (based on all your other great answers) but it is a little out of my current understanding level I'm afraid. I'll try to break it down one bite at a time and see what I come up with.

            • 3. Re: Script Help Request (Save As PDF)

              Feel free to post back with an example of your Set Variable step where you produce the File path.

              If you haven't done this in your current efforts, see this thread: Found Sets to PDF with unique file names

              • 4. Re: Script Help Request (Save As PDF)

                I'm reading everything I have on Custom Dialog Box right now and then I'll go to that next step - thanks for the link. I need to find a FM guru in Kentucky so I can take lessons in person!

                • 5. Re: Script Help Request (Save As PDF)

                  Here's what I ended up doing and I know that eventually I will have to figure out how to make the Path itself change based on different Event Registrations because I'm saving PDF's of the Invoices in a different folder for each different event:

                  Set Variable [$Filename; Value:EVENT INVOICE::NameFull & ".PDF"

                  Save Records as PDF [Restore; No dialog; "$Filename"; Current record] 

                  And, in the "Save Records as PDF" step I pasted the fixed pathway with the "winpath" prefix