Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6971 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.)

Posted

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

Posted

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

This topic is 6971 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.