gdemin / excel.link

Convenient Data Exchange between R and Microsoft Excel
56 stars 16 forks source link

timeout for calls blocked by modal windows? #8

Open randomee opened 8 years ago

randomee commented 8 years ago

If I cause excel to pop up a question dialog box, excel.link calls hang until I dismiss that excel window.

Would it be possible to add a timeout to these calls? I know I'd have to catch the error, but that's better than a hung connection.

(I'm using excel & rserve for remote access to data in excel workbooks. so there may not be anyone at the screen to click on the dialog box.)

gdemin commented 8 years ago

By now I don't know how it can be done. And, secondary, timeout may cause problems in case of long operations with large amounts of data.

randomee commented 8 years ago

As to how, I'm not much help. I assume it might be better exposed via RDCOM?

But for the long processing, I agree that it should not be turned on by default. If someone has a timeout that's too short, they did it to themselves. So that part does not bother me.

randomee commented 8 years ago

Not sure if this is useful, but here are some links about dealing with modal windows & prompts. https://msdn.microsoft.com/en-us/library/office/ff839782.aspx http://thebuildingcoder.typepad.com/blog/2009/10/dismiss-dialogue-using-windows-api.html

gdemin commented 7 years ago

Thank you for the links. I will read them. I think the most realistic way to implement timeouts is to make C code inside package compatible with base R function setTimeLimit. So one can write setTimeLimit(elapsed = 10) to set timeout to 10 seconds for further operation with Excel.

randomee commented 7 years ago

Having not played with it, I'd guess that would leave excel in a hung state as well. The current call would return, but with no/bad data, and no way to get back in excel. (short of a system() call to kill the excel process.)