File write mystery

I’m writing data to Filemaker:

  1. Create xml file.
  2. Execute AppleScript which tells Filemaker to import the xml file.
  3. The AppleScript updates a small text file which tells my app that the import has finished.
  4. Delete the xml file.
  5. Start the next record.

Sometimes Filemaker starts importing when the file is not there. Screen Shot 2021-10-25 at 6.37.15 pm

I have seen the error a couple of times myself. But I can’t reproduce it at all. Dropbox or iCloud are not involved. It occurs for different versions of macOS and Filemaker.

What could cause this? How do I make sure that the file is - like - really there?

A pure guess, but could this be nothing more than a timing issue? Perhaps introduce a small delay before it attempts to read the file?

Yes, this might be a timing issue. But I don’t see how this could be the case. Doing a small delay has been the only idea I came up with, too.

If it works, I take full credit. If it doesn’t, that’s all you.



Tried a .flush before the close?

That’s a good idea, too.