1 2 Previous Next 16 Replies Latest reply on Apr 8, 2010 1:47 AM by (O_O)

    Stupid Question...

    paintboothguy

      Title

      Stupid Question...

      Post

      Good Afternoon, 

       

      I am using the Contact Management template as well as my own layouts for invoices, etc.  The Contact Management layout has a button that will launch my email (mac) and enter the email address from that contact.

       

      Is there a way to place a similar button (script?) on a completed invoice record that will save the record as a pdf and email it to the client's email as entered without having to manually enter the email address into the email program?

       

      Thanks, 

      Andrew

        • 1. Re: Stupid Question...
          philmodjunk

          Yes

           

          You can save the invoice as PDF and then specify it in a send mail script step as an attachment. The usual trick is to set the path for the PDF in a variable to both specify the location to which to save the PDF and then the Send Mail script step can use the same variable to refer to the path as an attachment.

          • 2. Re: Stupid Question...
            paintboothguy

            Thanks for the help, Phil.

             

            I have succeeded in generating a script that saves the current record as a pdf to a folder of my choosing.  I have then used the same 'path' in the 'send mail' portion of the script, that correctly attaches the file, as well as 'looks up' the clients email address.

             

            However:

             

            I have noticed that when I try the script multiple times for different records, it replaces the file in the destination folder.  I also don't seem to be able to have the ability to name the file, or better yet, have the file named automatically by looking up a particular field, like 'Company Name."

             

            Am I asking for too much here?

             

            Thanks, 

            Andrew

            • 3. Re: Stupid Question...
              philmodjunk

              Quoting from my previous post:

               

              "The usual trick is to set the path for the PDF in a variable"

               

              In the variable where you set up the file path, you can include a calculation that refers to text in fields such as the company name so that each file gets a different file name.

               

              Here's an example adapted from one of my own scripts:

               

              Set Varible [$Path ; Value:  "filewin:" & Get ( DesktopPath )  & Table::CompanyName  & " " & Substitute ( Get ( CurrentDate) ; "/" ; "-" ) & ".PDF" ]

              • 4. Re: Stupid Question...
                paintboothguy

                Phil, 

                I've been trying to adapt the formula you provided me with:


                Set Varible [$Path ; Value:  "filewin:" & Get ( DesktopPath )  & Table::CompanyName  & " " & Substitute ( Get ( CurrentDate) ; "/" ; "-" ) & ".PDF" ]

                 

                The path to the destination folder is:

                 

                filemac:/Macintosh HD/Users/andrewbaca/Desktop/FM file path test/<new file name would go here.pdf>

                 

                The field where the file name would come from is:

                 

                Quotes::Full Name LU

                 

                So, 

                I have written the following in the dialogue box 'Specify Output File" (I get this box when I use 'Save Records as PDF):

                 

                Set Variable [$Path ; Value; 'filemac:" & Get ( filemac:/Macintosh HD/Users/andrewbaca/Desktop/FM file path test/ ) & Quotes::Full Name LU & ".PDF"]

                 

                FM reports that there is something wrong with the file path, then highlights the whole thing.

                 

                I'm kinda lost~!

                 

                -Andrew

                 

                 

                • 5. Re: Stupid Question...
                  philmodjunk

                  Make set variable a step in your script and just enter $Path in the destination dialog--which should be the next step.

                  • 6. Re: Stupid Question...
                    paintboothguy

                    After inserting the following:

                     

                    "filemac:" & Get (filemac:/Macintosh HD/Users/andrewbaca/Desktop/FM file path test/ ) & Quotes::Full Name LU & ".PDF"

                     

                    in the 'specify calculation' dialogue, FM says:

                     

                    "This parameter is an invalid Get function parameter", 

                     

                    then FM highlights 'filemac'. 

                     

                     

                    • 7. Re: Stupid Question...
                      philmodjunk

                      I'm using a get function to compute a file path that may be different on different computers on my network.

                       

                      In your case, you are using an explicit path that won't change. Remove the get function and just leave the entire path in quotes:

                       

                      "filemac:/Macintosh HD/Users/andrewbaca/Desktop/FM file path test/" & Quotes::Full Name LU & ".PDF"

                      • 8. Re: Stupid Question...
                        paintboothguy

                        Holy Cow, Phil!  That worked like a charm!  Thanks for walking me through it!

                        -Andrew

                        • 9. Re: Stupid Question...
                          RickWhitelaw

                          Or you could define the variable as Get(DesktopPath)&"yourfile.pdf"

                           

                          That would save the file to the desktop of the current logged-in user.

                           

                          RW

                          • 10. Re: Stupid Question...
                            philmodjunk

                            Which was what my original example did :smileywink:

                            • 11. Re: Stupid Question...
                              RickWhitelaw

                              Yup!

                               

                              The difference is that, although I tend to use"file:" at the beginning of each path, it makes no difference when I don't. The "filemac" or "filewin" seems redundant. Or, am I about to have a "Doh!" moment?

                               

                              RW

                              • 12. Re: Stupid Question...
                                philmodjunk

                                I think I'm about to have the "doh" moment!

                                 

                                Testing with "file:" instead of "filewin:" worked. Just learned something new!

                                • 13. Re: Stupid Question...
                                  RickWhitelaw

                                  As far as I can tell, you don't need any of "file", "filewin" etc. Setting a variable to save a pdf to Get(DesktopPath)&"myfile.pdf" seems to do the same thing as setting it as : "file:"&Get(DesktopPath)&"myfile.pdf".

                                   

                                  Rick

                                  • 14. Re: Stupid Question...
                                    philmodjunk

                                    When I try that on my windows xp system, I get an error message indicating the path is invalid.

                                    1 2 Previous Next