September 2, 200916 yr Our database has a script that adds a PDF file to a record so it can be sent by email (via the mail.it plug-in). The AppleScript is very simple: tell application "FileMaker Pro" set theFilePath to cell "InvoicePDFAttachment" of current record set the cell "InvoicePDFAttachmentContainer" of current record to (file theFilePath) end tell One of our client computers was upgraded to Snow Leopard and this script now fails when it gets to the Perform AppleScript step, the error says: FileMaker Pro got an error: Object or property is the wrong type. If I try to edit the AppleScript in the script step on the client running Snow Leopard it errors tells me it expected an end of line, etc. but found """ and indicates the problem is the quote around the cell field name. If I remove the quotes then AppleScript complains that it expected an end of line, etc. but found identifier. I take it there are significant AppleScript changes in 10.6, does anyone know if there are workarounds for what I am experiencing or will I have to hold off on upgrading my clients to 10.6?
September 2, 200916 yr Author May be, the script has been this way for YEARS, I don't remember why the script was done the way it was. Can someone suggest how a file can be added to a container via a script?
September 2, 200916 yr Give us some details to work with - from your AS it looks like you already have a path to the file in a text field, and you are setting a container field to it?
September 2, 200916 yr Author Yes, the script calculates what the file path to a file should be then inserts that file into a container. Sorry if this is super basic, my mind has been out of Filemaker Pro land for a while.
September 2, 200916 yr the script calculates what the file path to a file should be From what? Give us some example input data, and the formula.
September 2, 200916 yr Author There's an Invoice ID field, let's call it "ID", then there's a calculation that derives where the file should be, let's call it "PDFpathCalc" defined as "HardDrive:PDFs:" & ID & ".pdf" So for a given record where ID="31254" then PDFpathCalc="HardDrive:PDFs:31254.pdf" Now I just need to put that file into the container.
September 2, 200916 yr I believe that: Set Field [ Table::Container ; "filemac:/HardDrive/PDFs/" & Table::ID & ".pdf" ] should do just fine. Actually, you could change the container field to a calculation field, using the same formula, and dispense with the script altogether.
September 3, 200916 yr A change to AppleScript has been documented for Snow Leopard. http://filemaker.custhelp.com/cgi-bin/filemaker.cfg/php/enduser/std_adp.php?p_faqid=7354
September 3, 200916 yr In response to a question since deleted: There were changes in Applescript between OS X 10.4 and OS X 10.5. I don't know of any changes in FMP 10 - certainly not documented changes. Edited September 3, 200916 yr by Guest I'm not yet crazy enough to post out of context.
September 21, 200916 yr Had the same problem, wasn't solved by the internal Filemaker script. For me, the line set field "Image" of current record to file (curFilePath) as alias worked. I had been using "set cell "Image" of current record to file (curFilePath) but it has to be specified as an alias, and field for cell.
Create an account or sign in to comment