wplate Posted September 2, 2009 Posted September 2, 2009 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?
comment Posted September 2, 2009 Posted September 2, 2009 Couldn't the same thing be done by a native Filemaker script?
wplate Posted September 2, 2009 Author Posted September 2, 2009 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?
comment Posted September 2, 2009 Posted September 2, 2009 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?
wplate Posted September 2, 2009 Author Posted September 2, 2009 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.
comment Posted September 2, 2009 Posted September 2, 2009 the script calculates what the file path to a file should be From what? Give us some example input data, and the formula.
wplate Posted September 2, 2009 Author Posted September 2, 2009 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.
comment Posted September 2, 2009 Posted September 2, 2009 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.
Vaughan Posted September 3, 2009 Posted September 3, 2009 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
comment Posted September 3, 2009 Posted September 3, 2009 (edited) 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, 2009 by Guest I'm not yet crazy enough to post out of context.
wplate Posted September 3, 2009 Author Posted September 3, 2009 Thank you, comment, that works. I appreciate your time and patience.
N Cahill Posted September 21, 2009 Posted September 21, 2009 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.
Recommended Posts
This topic is 5540 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