MeanMike Posted May 26, 2007 Posted May 26, 2007 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
Fenton Posted May 26, 2007 Posted May 26, 2007 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.
MeanMike Posted May 26, 2007 Author Posted May 26, 2007 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
Fenton Posted May 27, 2007 Posted May 27, 2007 Well, it seems I was wrong, you CAN insert a file reference with FileMaker, by using the "file:" prefix. Thanks.
Recommended Posts
This topic is 6391 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 accountSign in
Already have an account? Sign in here.
Sign In Now