Adam Shelly
8/8/2008 6:02:00 PM
On 8/8/08, Bryan Richardson <btrichardson@gmail.com> wrote:
>>> I'm looking for a way to implement a non-threaded timeout
> Also, the Ruby interface I've developed for accessing the
> external application via the OLE interface has been designed as a
> Singleton and I don't know how well that would work with threads...
> without a lot of work synchronizing things and such.
>
I'm probably very confused, but isn't the the OLE interface
asynchronous already?
Aren't you already waiting until it is done?
The following example runs excel until I close it from the menu, or 30
seconds, whichever comes first. I'd think you could apply the same
thing to your app, especially if your simulation closes itself.
-Adam
-------------------------------------------------------------------------------------
excel = WIN32OLE.new("excel.application")
excel['Visible'] = TRUE;
t = Time.now
while ((Time.now - t) < IT_SHOULD_NEVER_RUN_THIS_LONG)
break if !excel.Visible #using Visible to check if it is running
#there is probably a better test.
sleep(1)
end
excel.Quit();