2 Replies Latest reply on Dec 6, 2013 11:13 AM by ChrisMacrander

    Use applescript to set value of container field with external file

    ChrisMacrander

      Title

      Use applescript to set value of container field with external file

      Post

           My question is well summarized on stack overflow, but the folks there don't seem to know the answer.

           I have a container field set to reference external files. When I manually insert a record from within filemaker, it works great. However, I would like to write an applescript that sets this value for me. I've tried several things but can't get it to work. Here's an example script I've tried.

      set theFilePath to choose file with prompt "Please select your file:"
      tell application "Finder"
          set theFile to file theFilePath
      end tell
      tell application "FileMaker Pro"
          set theRecord to create new record at database "MyDatabase"
          tell theRecord
              set cell "file" to theFile
          end tell
      end tell

           But like I said, that doesn't work. Can anyone tell me what WILL work? See the stack overflow post for specific error messages.