May 26, 200718 yr I'm having a problem inserting a file through script here is what i have set AttachmentPath to ("" & (path to documents folder) & "TEMP:") tell application "FileMaker Pro Advanced" set foo to (AttachmentPath & "release of information form.doc") set cell "msgAttachments" of current record of database "artcode" to a reference to file foo end tell this works if I tell it to insert a JPG file but not a word doc or RTF file yet if insert file through the menu I can insert anything
May 26, 200718 yr The FileMaker AppleScript dictionary was updated for FileMaker 7, for tables, but that command to set a cell to a file as a reference, is the same as it was in FileMaker 6. AppleScript doesn't have access to the Insert File command. One way to do this is to calculate the path, or set into a global field, in FileMaker syntax. Then call a FileMaker Insert File script from AppleScript: do script FileMaker script "Insert File" "Insert File" above is just what I named the script. If you change the name of the script the AppleScript will break. The script would first set a Variable to the FileMaker syntax file path, then Insert File. There are several variations on just how you get the path, and how you call the script. But basically you use a FileMaker syntax path and the Insert File script step. In many scenarios you no longer need AppleScript to do this.
May 26, 200718 yr Author Fenton, thank you for your response. it helped me allot... a guess FMP handles file paths in POSIX form and expects "file:" in front of the path. here is the code that works and it only gives a reference rather than putting the file in the database. set AttachmentPath to ("" & (path to documents folder) & "TEMP:") tell application "FileMaker Pro Advanced" set foo to POSIX path of (AttachmentPath & "CFW1D9.RTF") go to layout "Attachments" set cell "Attachment" of current record of database "artcode" to ("file:" & foo) end tell thanks again MeanMike
May 27, 200718 yr Well, it seems I was wrong, you CAN insert a file reference with FileMaker, by using the "file:" prefix. Thanks.
Create an account or sign in to comment