3 Replies Latest reply on Oct 12, 2011 8:53 AM by philmodjunk

    FIlemaker Pro Applescript bug in "write" command

    AlanHarper

      Title

      FIlemaker Pro Applescript bug in "write" command

      Post

      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.

      Details:

      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

      Please let me know if you need more information

       

       

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

          Alan, You've half answered your own question with the final AppleScript. As the "write" syntax is in the Standard Additions it isn't something that needs to be performed in the tell block for FileMaker Pro Advanced (and really shouldn't). If you need to capture some information from FileMaker Pro Advanced, capture that in a variable and then use the other code outside of the tell block. For instance, the following will work:

          tell application "FileMaker Pro Advanced"

          -- Do FileMaker stuff here

          end tell

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

          write "hello world" to FileRef

          close access FileRef

           

          What are you trying to achieve by performing the script code from within the FileMaker Pro Advanced tell block?

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

            I am trying to achieve syntactical convenience. This should work within or outside of a tell block. Obviously, I do know how to work around it, and one can always put a "tell me to" at the beginning of a statement, but it is really annoying to end a tell block, do one statement, and then enter a new tell block.

            I posted this here because FileMaker Inc told me that this is where to post bug reports, and I was hoping to have this report evaluated as a possible bug to be entered into Filemaker's bug database. There is no evidence that FileMaker staff actually read these (at least, they haven't commented).

            Oh well.

            Thanks Damon.

            A

            • 3. Re: FIlemaker Pro Applescript bug in "write" command
              philmodjunk

              Actually, Bug Reports should be posted to "Report an Issue". See the tab at the top of this screen.