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 write command error only in FileMaker

Featured Replies

I'm trying to setup an error capture method for catching errors from an AppleScript that will be called from FileMaker.

The test script is listed below. This script works fine using Apple's Script Editor but I get an error trying to add this script to the Perform AppleScript step in FileMaker. I'm trying to enter the exact script into the Native AppleScript field in the Perform AppleScript step but get the following error on the write command:

"Expected end of line, etc. but found """.

Does the write command need a different syntax than the normal AppleScript syntax?

try

return 100 / 0

on error

set fp to open for access file "Macintosh:Users:tomhorton:Desktop:NewFile" with write permission

write "productID, outputFailed" & return to fp starting at eof

close access fp

end try

  • Author

When I wrapped the on error section in a tell section the error was ignored by FileMaker.

try

return 100 / 0

on error

tell Application "Finder"

set fp to open for access file "Macintosh:Users:tomhorton:Desktop:NewFile" with write permission

write "productID, outputFailed" & return to fp starting at eof

close access fp

end tell

end try

  • 1 year later...

Did you ever figure this out? AFAICT, there is a subtle bug (that I don't understand) that makes the command "write" not compile when it surrounded by tell application "FileMaker"

This works:

set fileRef to open for access (path to desktop as string) & "outfile" with write permission

write "hi mom" to fileRef

close access fileRef

This does not compile (Error: Expected end of line, etc., but found """.)

tell application "FileMaker Pro Advanced"

set fileRef to open for access (path to desktop as string) & "outfile" with write permission

write "hi mom" to fileRef

close access fileRef

end

But this does compile and run correctly

tell application "FileMaker Pro Advanced"

set fileRef to open for access (path to desktop as string) & "outfile" with write permission

tell application "Finder"

write "hi mom" to fileRef

end tell

close access fileRef

end tell

Seemingly FileMaker is changing the meaning of "write" but I don't understand the details. I suspect that this is a bug in FileMaker. Any insight on this?

TIA

There is no bug here. When you address a specific application, you must use terms from that application's dictionary.

comment—

Your second sentence is (obviously) true. However, "write" does not appear in the dictionaries of either Finder or FileMaker Pro Advanced. The command "write" only occurs in dictionary of the Standard Additions scripting addition. Did you try the examples? I still think that this is ( a ) subtle and ( b ) possibly a bug on the part of FileMaker.

You are right. I was briefly under the impression that Filemaker doesn't support any of the Standard Additions - but of course it does many of them, so not supporting read or write seems like a weird omission.

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.