2 Replies Latest reply on Jul 10, 2009 6:56 AM by MikePR_1

    Peform Applescript timing out at 2 minutes

    hiatts

      Title

      Peform Applescript timing out at 2 minutes

      Post

      Hi,

       

      I am executing a Perform Applescript step with "with timeout" statements in the applescript, yet it continues to timeout at 2 minutes.

       

      The Applescript target application continues to run, however filemaker at 2 minutes receives the timeout from Applescript and proceeds with the next step in the code. The Applescript target app cannot be communicated with via Applescript as it is still executing a task. If I run the Applescript outside of filemaker the timeouts work. 

       

      Is there anyway to control the applescript timeout that appears to be fixed when using Perform Applescript within filemaker? 

       

      The only work around I can think of is to take the Applescript out of filemaker and execute it on the OS, rather then from within filemaker. 

       

      Stuart 

        • 1. Re: Peform Applescript timing out at 2 minutes
          TSGal

          hiatts:

           

          Thank you for your post.

           

          Yes, there is a time out limit of two minutes.  This is documented in the online Help under "Apple events error: "Apple event timed out" (-1712) ".  However, this can be expanded (as explained in the online Help).

           

          To prolong the amount of time AppleScripts waits for a response: Use the "with timeout" statement.

           

          An example of such a statement that increases the wait time to five minutes is: 

           

          tell application "FileMaker Pro"

          with timeout of 300 seconds

          Show (every Record whose Cell "Product" contains "FileMaker Pro")

          end timeout

          end tell

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: Peform Applescript timing out at 2 minutes
            MikePR_1
              

            You are not the only one that had that same problem. The way that FileMaker communicates with AppleScript has a very "Strict" syntax and I'm really trying not to use the word 'weird' in this sentence. I had the same problem when I tried to "Activate" an external program to convert a lot of pictures. I even found out that, If i want to declare some variables at the beginning of the  AppleScript that I pasted inside the FileMaker script, it helps a lot to start the AppleScript with

             

            tell application "FileMaker Pro

            activate

            set myVariable to 5

            end tell

             

            with timeout of 1200 seconds

              try

                tell application "the external application"

                activate

                  "Do something"

                end tell

              end try

            end timeout

             

            tell application "FileMaker Pro

            activate

            end tell

             

            Hope this helps...