1 2 Previous Next 20 Replies Latest reply on Apr 27, 2011 9:21 PM by jamroman

    PDF setup



      PDF setup


      I want to setup a internet so when i Save a PDF to send a email but with a name put in for me. for example

      Job Name : Cars

      Invoice ID: 25

      is there a way i can make a script that saves and sends a email but automaticly names the PDF file Cars25 so i dont have to do it all the time.

        • 1. Re: PDF setup

          You can write a script that constructs the filepath and file name for your PDF, saves it and then opens Send Mail to send it as an attachment.

          Set Variable [ $Path ; Value:  "file:" & Get ( TemporaryPath ) & YourTable::Job Name & YourTable::InvoiceID & ".PDF" ]
          Save Records as PDF [Restore ; No Dialog ; "$Path" ; Automatically Open ; Create Email ; Current record]

          You may or may not want to choose automatically open and you may want to specify records being browsed instead of Current Record depending on the needs of your database.

          • 2. Re: PDF setup

            I use Thunderbird does this script work with it im not sure if im doing somthing wrong cause after i use the script it just saving pdf but nothing happens

            • 3. Re: PDF setup

              You can look up Send Mail in FileMaker help to see a list of compatible Email Client options for FileMaker. I don't think Thunderbird is listed.

              You can still save the PDF, you just can't open your email program with a new email and the PDF already attached. Thus, you might want to use Get ( DesktopPath ) instead of Get ( TemporaryPath ) so that the newly created PDF is easier to find to attach to your email.

              • 4. Re: PDF setup

                How about i want the files to be specifcly saved in a fold in the desktop

                • 5. Re: PDF setup

                   "file:" & Get ( DesktopPath ) & "Folder Name Here/" & YourTable::Job Name & YourTable::InvoiceID & ".PDF"

                  You'll get an error when the script runs if the folder doesn't exist or if you misstype its name in this expression.

                  • 6. Re: PDF setup

                    I looked at your responses but I am really new to FileMaker and databases. I am using filemaker with Microsoft. I tried to write what you wrote on the forum under a new script, but it is giving me a problem. I chose "Set Variable" from the selection list and clicked on "Specify", but I don't know what to do next. It is asking for a Name, Value and Repetition. I want it to generate the name of the PDF file through a field name called "LT #" of that specific layout and save it under a single folder

                    Here is the error message I take:

                    ":" & Get ( TemporaryPath) & TRANSMIT::LT # & . "PDF" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

                    And here is what it writes for the script:

                    Set Variable [$Path; Value:"\"filewin:/P/Trs-PDF/:\"&Get(TemporaryPath) & TRANSMIT::LT # & . \"PDF\""]
                    Save Records As PDF[Restore; No dialog; "$Path"; Current record]

                    The folder I am trying to save the PDF files is filewin:/P:/Trs-PDF/
                    The table's name is TRANSMIT and the layout's name is Transmittal 2009.
                    The field that I want the names of the PDF files comes from field LT #



                    • 7. Re: PDF setup

                      You have some quotes and backslashes that are keeping the expression from evaluating correctly. Also, Get (TemporaryPath ) is a function that computes the path to your TemporaryItems folder on your system. Since you are specifying a different location, you don't need this function.

                      Try this expression and see if it works:

                      Set Variable [$Path ; Value: "file:/P:/Trs-PDF/" & TRANSMIT::LT # & ".PDF"]

                      • 8. Re: PDF setup

                        Works great!!

                        Thanks alot!

                        • 9. Re: PDF setup

                          I just have another quick question.  In my previous post, I defined the path to save the PDF under which folder.  Lets say I have an A folder which has some subfolders 1,2,3,4 etc. and these have subfolders with 001,002,003, etc. and these folder names are also in the fields of the layout I want to save.  Is there anyway for FileMaker to find the folder name that matches with the field name on that current document and name it as "3, 001" and save it under the folder that matches with the field name? And can it make it do this everytime a different layout is open?

                          i.e: There is one ClientA and ClientB.  There are 2 jobs that has been done for them, 01 and 02.  I want to save the PDF under a folder that already exists which is ClientA and there is a subfolder named 02.  Is there any way to tell the filemaker to make a search on a folder and save the layout under matched folder name with the field name on that layout?


                          • 10. Re: PDF setup

                            I don't see why you need to "search for a folder" unless you need to confirm that the folder already exists before saving to it. That can be done, but requires one of the file plug ins or an apple script.

                            Just saving your PDF to a folder named in another field, simply requires adding those fields to your $Path's value expression.

                            Set Variable [$Path ; Value: "file:/P:/Trs-PDF/" & Transmit::Job & "/" & TRANSMIT::LT # & ".PDF"]

                            Just watch out for the leading zeroes here, you may need to include Right ( "00" & Transmit::Job ; 2 ) to make sure the leading zero is included.

                            • 11. Re: PDF setup

                              I have numerous clients and would like to save the PDF under the client's folder but I was wondering if it can be done automatically.  So when I open a layout that is for client A, when I click the save button, I want it to find the folder Client A and save it under that file but I have clients A-Z so when I open a layout of Client J later on, I want it to find the folder Client J and save it under that folder. 

                              • 12. Re: PDF setup

                                That's what the last example shows. As long as the folder names are stored in fields in your database, you can use them in the file path calculation to specify the folder and subfolders for each client.

                                • 13. Re: PDF setup

                                  When I tried to run this scripts I am getting an error saying that {JOB-LIST}::Job_Folder_Client & {JOB-LIST}::Job_Folder_Year & {JOB-LIST}::Job_Folder_Name could not be created on this disk. 

                                  {JOB-LIST}::Job_Folder_Client is the field where the information exists for the first folder to save it.  {JOB-LIST}::Job_Folder_Year and {JOB-LIST}::Job_Folder_Name are the subfolders of that folder which I am trying to save the PDF to.  Job Accounting Phases::JAP_Job Number is the file name of PDF I am trying to save as. 

                                  The actual script that I wrote is:

                                  Set Variable [$Path, Value:"filewin:/J:/{JOB-LIST}::Job_Folder_Client & {JOB-LIST}::Job_Folder_Year & {JOB-LIST}::Job_Folder_Name " & Job Accounting Phases::JAP_Job Number & ".PDF"

                                  • 14. Re: PDF setup

                                    You've got quotes in the wrong place again. The pair of quotes after Job_Folder_Name mean that this is being treated as literal text instead of evaluating them to return the text stored in these fields.  You also need / between each folder name. Compare what you are trying to use to my last example.

                                    "file:/P:/Trs-PDF/" is enclosed in quotes as there are no field names here, just the exact text that marks the start of my file path.

                                    /" & Transmit::Job & "/" computes a folder name using the data stored in Transmit::Job. Note the / characters that come before and after to make this a folder name and not part of the file name.

                                    TRANSMIT::LT # & ".PDF" then computes the name of the PDF file being created.

                                    1 2 Previous Next