4 Replies Latest reply on Feb 1, 2017 7:43 AM by plaquesexpress

    Newest PDF into a container

    plaquesexpress

      Hi everybody,

      I have a little problem and I try to find an easy way to solve it

       

      I want to import into a container field an image of a PDF from a folder on my Mac, but i must import the latest version of the PDF. Sometime the folder is empty, sometime there is only one file and sometime there is a lot of file. The name of the PDF change constantly …

       

      Should I use AppleScript with FileMaker ?

       

       

      Thanks in advance

        • 1. Re: Newest PDF into a container
          philmodjunk

          How would you identify the newest copy of the file from others? By the "modified date" associated with the file?

           

          If so and if you don't want the user manually selecting the file to insert, you'll need either a plug in or a system script (of which AppleScript is one possibility).

          • 2. Re: Newest PDF into a container
            plaquesexpress

            I want the newest modified file so yes by the modification date

             

            Did you have an example of AppleScript that can do that ?

             

            Thanks

            • 3. Re: Newest PDF into a container
              philmodjunk

              Sorry, but others will have to help you with AppleScript. Haven't used that tool in many years so my info is way out of date.

              • 4. Re: Newest PDF into a container
                plaquesexpress

                Thanks for your help

                 

                I found a Applescript to do that but can somebody tell me how to pass the value back to Filemaker (from the Perform Applescript in my script) ... i try a lot of combination but nothing seem to work ...

                 

                i try these lines on my script

                 

                "tell application \"Finder\"¶

                  set myFolderName to \"" & $lien_pdf & "\"¶

                  set myFileName to first paragraph of (do shell script \"ls -t \" & myFolderName)¶

                  set cell \"Projet::TEMP_variable_pdf\" of current record to myFileName as text¶

                end tell"

                 

                I was able to get the name of the newest file of my folder without problem, but when AppleScript try to send it back to FileMaker, I always have these errors :

                 

                 

                Screen Shot 2017-02-01 at 10.38.03.png

                Screen Shot 2017-02-01 at 10.38.07.png