views:

54

answers:

0

Hi!

I have implemented a ruby script that is capable of opening a word document through the Ruby WIN32OLE automation library and does a search and replace on some specified string.

This script is running as a "service", or it is running on a windows server with a session that is allowed to be running forever, and I just push the 'X' instead of logging out. A hack...

However, my problem is that sometimes msword pop up an error message or some other information that requiers the "user" to push an 'OK' or 'CANCEL' button, but I'm not able to detect this programatically. This causes my script to hang until I have the chance to check upon it and click the button manually. This is not very productive in a production environment...

So any ideas how user promts can be dealt with gracefully in this scenario?

I believe one solution might be to have a thread checking upon open msword instances, and if they are not closed after a period of time, the thread quits the instance and reports an error on the open filename. However, I'm not sure if this is the way to go....