We are having an issue with an Applescript we use to extract data out of FileMaker and generate InDesign files.
The Applescript is run outside of FileMaker.
It seems that when the Applescript tells FileMaker to execute a script or other command, FileMaker reports that the call was successful as soon as the script/command has started executing, not once it has finished.
This means that the Applescript moves onto its next step, which may not be able to run.
Applescript calls FM script which performs a find, and sorts the results.
Applescript then loops through the records processing them.
The issue is that when the Applescript attempts to pull data out of the first record, FileMaker may still in the process of finding the data, so the Applescript falls over.
This issue started happening with FileMaker 11 I believe, it did not seem to be a problem in earlier versions. After talking to our system administrator again he has confirmed this has always been an issue, it just seems to get worse with each new version!
I don't develop or manage the Applescripts myself, but I believe our system administrator who looks after them has inserted "Delay X" commands all through his scripts to give FileMaker time to complete the requested task before his script moves on.
My question is, has anyone else come across this sort of thing? And is there a way to fix it?
If not, what other work around's have people had success with?
The "Delay X" solution seems to work for the most part, but if there is any unexpected lag on the network when the process is run X may not be large enough so the script fails.
One option we have had a look at is to have the FileMaker scripts always end by going to another layout, and then have the Applescript set up a loop checking if the layout name = that layout. Once the layout name matches the Applescript then moves back to the layout it wants to be on and continues processing. This is a bit of a pain to set up everywhere the Applescript may end up needing to wait for FileMaker though!