2 Replies Latest reply on Jan 4, 2012 1:37 PM by AlanHarper

    FIlemaker Pro Applescript bug in "write" command

    AlanHarper

      Summary

      FIlemaker Pro Applescript bug in "write" command

      Product

      FileMaker Pro

      Version

      11.0 v4

      Operating system version

      10.6.8

      Description of the issue

      There is a bug in FileMaker Applescript support, where the "write" verb is somehow mangled. I suspect that this bug is in the FileMaker dictionary, not in the actual implementation of AppleScript, but I can't be sure. It is subtle, and I don't have the tools to figure it out completely.

      Steps to reproduce the problem

      The verb "write" is in the standard additions to AppleScript (English, Mac OS 10.6.8). It is used to write to a file reference. For instance:

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

      However, if you try to this same code in the context of FileMaker's dictionary (using a Tell block), it won't compile. The fact that it won't compile suggests to me that there is an issue with FileMaker's dictionary. But I do not understand what that issue might be, because the word "write" does not appear in FileMaker's Dictionary as seen in AppleScript Editor. The following code does not compile

      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

      Further suggesting that the issue is with FileMaker's Applescript Dictionary, the following code does compile (and execute 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

      Expected result

      It should compile

      Actual result

      It doesn't compile

      Exact text of any error message(s) that appear

      AppleScript Syntax Error
      Expected end of line, etc. but found "''".

        • 1. Re: FIlemaker Pro Applescript bug in "write" command
          TSGal

          Alan Harper:

          Thank you for your post, and I apologize for the late reply.

          "Write" needs to be referenced within the Finder's context, so wrapping it within a "tell finder" is correct, and therefore, it will compile.

          Besides, if you copy the first set of code into the Applescript Editor, it doesn't compile.

          TSGal
          FileMaker, Inc.

          • 2. Re: FIlemaker Pro Applescript bug in "write" command
            AlanHarper

            TSGal,

            I agree with your analysis completely. But I believe that this is due to some bug in Filemaker's implementation of AppleScript. Since "write" does not appear in Filemaker's dictionary, it shouldn't (I believe) have any effect on the meaning of that word, but should just pass it to the wider context like most (all?) other programs do. I suspect that there is something in FileMaker's applescript code that is confusing the AppleScript interpreter--it is expecting FileMaker to either implement "write" or not implement "write", and FileMaker is doing something half-way in between.

            Sorry for the vagueness of this analysis—I used to understand the details of Applescript from a programmer's perspective, but I no longer remember it, and, in any event, I don't have the tools to analyze the situation better.

            A