October 21, 200520 yr I have a short AppleScript to insert a text file into a specific field in FM8. However, I only want the file to go into the field of the Current Record. Is there a way of doing this using: set cell "XYZ" of record Current Record of table "ABC" to text_file As text ? Thanks, Charlie
October 21, 200520 yr The phrase "insert a text file" could have 2 meanings. Do you mean a FileMaker "Insert File" (as a file) or do you mean "put the text contents of a text file into a field"? If the latter, you can read a text file with AppleScript, using either: read file "Mac path to file" or do shell script "cat POSIXpathToFile" (should be "quoted form of POSIXpathToFile" if there's any spaces, which there usually are) "Read File" must be in a Finder or other tell block if inside a FileMaker Perform AppleScript step, not just on its own: tell application "Finder" to set theTxt to read file "Mac path to file" set cell "Txt" of current record of layout "layout name" to theTxt (P.S. I don't think "table" has a current record, only layout; the current layout being the default.)
October 21, 200520 yr Author I want to insert the contents of a text file. The script example will do this, and actually give me a dialog box with which to select the file. However, the crunch is which record, the text file gets inserted into. I need to be able to tell FM from Applescript which Record - ie. the Record number that corresponds to the Current Record Regards, Charlie
October 21, 200520 yr Author Fenton, I sorted it with the following script: tell application "Finder" set the file_to_read to read ¬ (choose file with prompt ¬ "Select contig file:") tell application "FileMaker Pro Advanced" tell database "Molecular Lab Database.fp8" tell window "Molecular Lab Database" set field "Imported Consensus" to file_to_read as text end tell end tell end tell end tell Thank-you for all your input to this and my other queries. Regards, Charlie
Create an account or sign in to comment