8 Replies Latest reply on Jun 1, 2011 8:55 AM by Heather

    Need help creating script to send multiple unique email invoices from a found set

    Heather

      Title

      Need help creating script to send multiple unique email invoices from a found set

      Post

      Ok, I am COMPLETELY stumped.  I have spent many laborious days creating a database for my piano studio and have run into a brick wall.  I created an invoice layout within my database that I thought I would be able to use to send out unique invoices to all of my students with the push of a button (ha!).  I've created a script that will send the emails to each member of my studio but the content of the email is empty.  Then I created a script that included a PDF of the entire collection of invoices rather than individual ones.  Any ideas?  Desperate for some help here.

      Heather

        • 1. Re: Need help creating script to send multiple unique email invoices from a found set
          philmodjunk

          A bit more detail on what you have tried so far may help.

           "Then I created a script that included a PDF of the entire collection of invoices rather than individual ones."

          That sounds like you almost got what you needed. FileMaker sends plain text so an attached PDF is the only way to send an image of an actual Filemaker layout to your recipients. If you set up your save as PDF step to use the "Current Record" option, you should be able to attach each student's invoice as a PDF that they can open and view when they receive your email. That assumes, of course, that you have a script that can loop through the invoices table generating a PDF for each student.

          • 2. Re: Need help creating script to send multiple unique email invoices from a found set
            Heather

            Thank you so much for trying to help me.  If I can't get past this one glitch then I feel like I will have wasted both my money and hordes of time on the program.  I've been able to attach a PDF to an email that included one (current record) or all records by following this path:

            File - Save/Send Records As - PDF . . . 

            I'm hoping to figure out how to write a script that will automate this process.  Ideally I would like for it to send the individualized invoices one right after another without me having to manually attach each one to an email, address the email, and send.  While I was very fluent with the Appleworks DB software, I have no experience writing scripts.  All of the resources I've found assume that the user has some programming knowledge/expertise.  Am I correct in believing that Filemaker Pro is capable of doing this task?  It's the reason I bought the software.  Do you know how to write the script?  If we can accomplish this, I will then want to create a modified script that will then perform a search that eliminates the students who have already paid their piano tuition.  I've already created and saved the search.  I just can't get past figuring out how to send these invoices.

            I really really appreciate your help!

            Heather 

            • 3. Re: Need help creating script to send multiple unique email invoices from a found set
              philmodjunk

              You're right about the assumptions here. If you were to invest some time and $$ into acquiring a good working knowledge of FileMaker scripting, it would provide you with a much larger tool box for solving such issues.

              Scripts can certainly save a PDF and then the script can attach the PDF to an email and send it. The details can depend on the structure of your database and I know nothing about how you've set this up.

              I'm going to assume that you have a layout where you can perform a find to pull up a found set of all the invoices you want to send out by email. This part can be scripted or you can do this part by entering find mode and specifiying criteria for finding the records you want for this.

              Go To Record/Request/Page [First]
              Loop
                  #See this link for a thread on how to save a PDF in a script:  Found Sets to PDF with unique file names
                   Set Variable [$path ; //put an expression here that computes the path and file name to where you want to save your PDF here. ]
                   Save Records as PDF [Restore; No Dialog; $path ; Current Record ]
                   Send Mail [Send via e-mail client ; no dialog; To: Table::EmailAddress ; Subject: "Latest Invoice" ; Message: "See attachment..." ; "$Path"]
                   Go To Record/Request/Page [next ; Exit after last ]
              End Loop

              To specify $path as an attachment, open the send mail dialog, click the attachment check box and enter $path without quotes into the dialog that pops up.

              • 4. Re: Need help creating script to send multiple unique email invoices from a found set
                Heather

                Bless your heart!  As soon as I can find a quiet moment to concentrate I'm going to reread the section on scripting in the tutorial, read the same chapter in the Missing Manual book, go over the link and info you just sent me and try again.  I really appreciate your efforts.


                Heather

                • 5. Re: Need help creating script to send multiple unique email invoices from a found set
                  Heather

                  As retarded as this is going to sound . . . I'm having trouble figuring out how to designate the filepath.  I'm trying to do something simple to test it like put in a folder titled Studio_Invoices on my Desktop.  I use a Mac.  When I type in what I think is the filepath (Desktop/Studio_Invoices) I keep getting an error message saying that it can't accept my input because it contains symbols that are not allowed . . . I presume it doesn't like my "/" but I don't know any other way to list a file path. 

                  • 6. Re: Need help creating script to send multiple unique email invoices from a found set
                    Heather

                    I ended up calling the tech support line for final help with the syntax of the file paths.  It was tricky.  I never would have figured this out.  All is working now!  Thank you so much for your help!

                    • 7. Re: Need help creating script to send multiple unique email invoices from a found set
                      philmodjunk

                      The link I posted in my last reply included an example of using Get ( DesktopPath ) in a calculation to compute the file path and store it in a variable.

                      • 8. Re: Need help creating script to send multiple unique email invoices from a found set
                        Heather

                        Doh!  Can't believe I missed that.  There were several other issues that they helped me with.  I'm going to try to pretend like I didn't just waste my money.