1 Reply Latest reply on Jan 21, 2015 6:40 PM by jared944

    Syntax for Applescript/Terminal Command

    jared944

      Title

      Syntax for Applescript/Terminal Command

      Post

      Hey everyone,

      I need to merge 2 PDFs and the "append" function doesn't work because I have to append a PDF to the beginning of an existing PDF (the append feature only adds to the back, sadly). Specifically, what I am trying to do is add a cover sheet to a document before I send it via my email fax service.

      So, doing some research, I found a python script buried in an automator action that is already found on OSX : System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py

      So, I now have an apple script I can use to merge 2 pdf's :

      tell application "Terminal"
          do script "cd \"/Users/user/folder\""
          do script "/System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/join.py -o final.pdf cover.pdf content.pdf" in window 1
      end tell

      My question is - how do I get the syntax right to add this as a filemaker script step? Ive tried nearly a dozen combinations and I still cant get it right.

      Any help would be greatly appreciated.

      Thanks,

       

      Jared

       

        • 1. Re: Syntax for Applescript/Terminal Command
          jared944

          Hey all,

          So, I spent some time on this and found out a better workaround without having to use terminal. By using the "do shell script" function, I can make the applescript a lot more simple :

          do shell script "cd /Users/Username/folder; /System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/join.py -o final.pdf cover.pdf content.pdf"

          This way we avoid Terminal from having to open/close in the background. I created a test calculation field to find the correct syntax, which turns out to be :

          "do shell script " &  "\"cd /Users/jaredhagan/desktop; /System/Library/Automator/Combine\\\ PDF\\\ Pages.action/Contents/Resources/join.py -o final.pdf cover.pdf content.pdf\""

          Filemaker opens an merges two PDF's, cover.pdf abd content.pdf, and the product is final.pdf.

          Hope this helps,

           

          Jared