My program creates MS Word (COM object), opens a file and then saves it as HTML. After that I open HTML file in read only mode and parse it. After I have done it I want to erase the HTML file but usualy it says : "Warning: Unlink failed (Permission denied)".
I think this is because the MS Word has not closed yet despite that I have called $word->Quit();
I can make 2 things to stop this error message
1. Do $word->Quit() twice but sometimes (not too often) it says that word has already quit.
2. Do sleep(1) and then unlink but since I can not doo less that sleep(1) its quite a delay. I could make like usleep(200) but usleep does not work under Windows.
What could be the suggestions to avoid this unlink problem?
-Arnis