1 Reply Latest reply on Dec 26, 2008 12:55 PM by Jens Teich

    Custom function to read first line of mac text file

    fwaboiler

      Title

      Custom function to read first line of mac text file

      Post

      Is it possible for a custom function to read the first line of a text file?

        • 1. Re: Custom function to read first line of mac text file
          Jens Teich
             With some AS it is possible

          set myDatabase to "theDB"
          set myTable to "theTable"
          set myField to "theField"
          set firstline to do shell script "head -n 1 theFile"
          tell application "FileMaker Pro Advanced"
               create new record of table myTable of database myDatabase
               set myRecord to ID of result
               tell record ID myRecord of table myTable of database myDatabase
                    set cell myField to firstline
               end tell
          end tell


          theFile can be /User/johndoe/file.txt or so.

          If you don't use FM Advanced version the application name is 'FileMaker Pro' without 'Advanced'!

          Jens