MSWord - File in Use dialog - close with script

conrad2010 used Ask the Experts™
I am working in an environment where hundreds of MS Word documents are processed automatically... every now and then this "File In Use" dialog pops up and all I have to do is hit the "Read Only" button to release this document.

Does anyone has a tip on how to detect if this dialog is up and maybe have a routine to close this dialog? Even if we have to build a Windows Service, or a MS-DOS service with VBScript that detects this dialog every 5 minutes would be great.

I understand I have to look for the owner file (starting with ~$ in the file name) and I understand I can delete that file to release the lock. Just have to figure out on how to click the ok button once that happens.

Screencap attached...
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
You can try using AutoIt and use WinWait for wait for the File In Use window, then click the Read Only button.  See here for an example:



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial