Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AppleScript change in Snow Leopard?

Featured Replies

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?

Couldn't the same thing be done by a native Filemaker script?

  • 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?

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?

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

the script calculates what the file path to a file should be

From what? Give us some example input data, and the formula.

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

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.

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

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.

  • Author

Thank you, comment, that works. I appreciate your time and patience.

  • 3 weeks later...

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.