AnsweredAssumed Answered

Applescript "do script" command does not wait for FileMaker script completion before returning

Question asked by VerneArase on Jul 22, 2010
Latest reply on Aug 21, 2015 by TSGal

Summary

Applescript "do script" command does not wait for FileMaker script completion before returning

Product

FileMaker Pro

Version

11.0v2

Operating system version

MacOS X 10.6.4 shepped with MacBook Pro 17 (early 2010)

Description of the issue

Applescripted "do script" command apparently does not wait for FileMaker script completion before returning.

Problem summary:

I do analysis, maintenance, and update of our ISC DHCP servers. To do this, I use a bash script to connect to our DHCP servers, download parameter files, analyze them with a C program, and write four text files which I need to import into FileMaker databases (clear out all records and import new data from the text files).

The bash script runs the following AppleScript:


tell application "FileMaker Pro"
     activate
     with timeout of 600 seconds
          open "Main:Users:varase:Documents:FileMaker:LUMC Hosts.fp7"
          do script "Refresh Contents"
          open "Main:Users:varase:Documents:FileMaker:LUMC Static Hosts.fp7"
          do script "Refresh Contents"
          open "Main:Users:varase:Documents:FileMaker:LUMC Subnets.fp7"
          do script "Refresh Contents"
          open "Main:Users:varase:Documents:FileMaker:LUMC Free IPs.fp7"
          do script "Refresh Contents"
     end timeout
end tell

When I manually run the AppleScript, the following happens:

1. FileMaker Pro launches
2. The FileMaker Pro LUMC Hosts document opens
3. The AppleScript Editor gets an error attempting to open the FileMaker Pro LUMC Static Hosts document. (error "FileMaker Pro got an error: Data is being accessed by another user, script, or transaction." number -10011)
4. The script Refresh Contents from the LUMC Hosts document runs

If I manually open each of the four FileMaker documents and manually run the Refresh Contents script, it works fine.

The Refresh Conents FileMaker script exists in each of the four FileMaker files, and is essentially the following three commands:

1. Show All Records
2. Delete All Records [No Dialog]
3. Import Reports [No Dialog; ; Add; Mac Roman]

The problem appears to be that FileMaker Pro can't handle multiple silmultaneous AppleScript commands, and while the "do script" is executing for the LUMC Hosts file the next open is attempted because FileMaker returned control to the AppleScript.

This was not happening under FileMaker Pro 9 Advanced (I just upgraded to 11.0v2).

Steps to reproduce the problem

I can send you the files if you need them, but this should be easy to test in-house since it is an elemental part of your processing.

Expected result

Each of the four files would open and replace their entire contents from four corresponding text files.

Actual result

An error attempting to open the second FileMaker document.

Exact text of any error message(s) that appear

Result:
error "FileMaker Pro got an error: Data is being accessed by another user, script, or transaction." number -10011

Configuration information

MacBook Pro 17 Core i7 (Early 2010), MacOS X 10.6.4, 8GB RAM, 1000GB HDD, FileMaker Pro 11.0v2, AppleScript Editor 2.3 (118), AppleScript 2.1.2,

Workaround

None so far, but I'm looking to see if AppleScript has a pause or sleep command.

Outcomes