May 24, 201015 yr 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
May 25, 201015 yr 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
July 26, 201114 yr 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
July 26, 201114 yr There is no bug here. When you address a specific application, you must use terms from that application's dictionary.
July 26, 201114 yr 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.
July 26, 201114 yr 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