1 Reply Latest reply on Dec 3, 2012 6:03 PM by VincentAngeloni

    Applescript won't compile in FM Pro Adv 12

    VincentAngeloni

      Summary

      Applescript won't compile in FM Pro Adv 12

      Product

      FileMaker Pro

      Version

      12.0v3

      Operating system version

      Mac OS X 10.8.2

      Description of the issue

      An Applescript which compiles in Script Debugger 5 and ran successfully fails to compile in FM Pro Adv 12 when inserted into a Perform Applescript script function

      Steps to reproduce the problem

      1) create a script and select "Perform Applescript" as the only step
      2) Click on "Specify" in the Perform Applescript script step options area
      3) select "Native Applescript" in the dialog box which pops up, and paste in the following applescript:

      --
      set filePath to choose file with prompt "Select a text file to add:" of type {"txt"}
      set foo to open for access filePath
      set savedInfo to read foo
      close access foo

      tell application "FileMaker Pro Advanced"
           set cellValue of the cell "Ingredients" of current record to savedInfo
      end tell
      --

      Then click OK, and instead of compiling successfully, you get an error. "foo" is highlighted in the line "set savedInfo to read foo" and the error reported is "Expected end of line but found identifier."

      Expected result

      The Applescript successfully runs in Script Debugger and compiles without error. It should do the same in FMProAdv

      Actual result

      instead of compiling successfully, you get an error. "foo" is highlighted in the line "set savedInfo to read foo" and the error reported is "Expected end of line but found identifier."

      Exact text of any error message(s) that appear

      "Expected end of line but found identifier."

      Workaround

      none.

        • 1. Re: Applescript won't compile in FM Pro Adv 12
          VincentAngeloni

               workaround:  enclose the read file routine in a tell statement. This seems to fix the problem.

               tell application "Finder"

             set filePath to choose file with prompt "Select a text file to add:" of type {"txt"}
             set foo to open for access filePath
             set savedInfo to read foo
             close access foo

          end tell

          tell application "FileMaker Pro Advanced"
          set cellValue of the cell "Ingredients" of current record to savedInfo
          end tell