# File write mystery

**URL:** <https://forum.xojo.com/t/file-write-mystery/66263>\
**Category:** General\
**Created:** [October 26, 2021, 5:35am UTC](https://forum.xojo.com/t/file-write-mystery/66263 "2021-10-26T05:35:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [October 26, 2021, 5:35am UTC](https://forum.xojo.com/t/file-write-mystery/66263/1 "2021-10-26T05:35:49Z")

</div>

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](https://forum.xojo.com/uploads/default/original/2X/8/86831e9caa8ce7cce5369601f73842dd6748731d.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [October 26, 2021, 5:51am UTC](https://forum.xojo.com/t/file-write-mystery/66263/2 "2021-10-26T05:51:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [October 26, 2021, 5:52am UTC](https://forum.xojo.com/t/file-write-mystery/66263/3 "2021-10-26T05:52:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [October 26, 2021, 5:53am UTC](https://forum.xojo.com/t/file-write-mystery/66263/4 "2021-10-26T05:53:57Z")

</div>

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

😃

---

<div class="post-metadata">

**Author:** ![anon20074439](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@anon20074439](https://forum.xojo.com/u/anon20074439)\
**Post date:** [October 26, 2021, 10:19am UTC](https://forum.xojo.com/t/file-write-mystery/66263/5 "2021-10-26T10:19:03Z")

</div>

Tried a .flush before the close?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [October 26, 2021, 10:34am UTC](https://forum.xojo.com/t/file-write-mystery/66263/6 "2021-10-26T10:34:10Z")

</div>

That’s a good idea, too.
