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

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

Recommended Posts

Posted

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?

Posted

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?

Posted

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?

Posted

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.

Posted

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.

Posted

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.

Posted

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

Posted (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 by Guest
I'm not yet crazy enough to post out of context.
  • 3 weeks later...
Posted

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.

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