How to know that a second application has finished?
Mark Hammond
mhammond at skippinet.com.au
Wed Dec 19 06:48:05 EST 2001
Enrique wrote:
> Hi,
> Let me put my question again, in a different and more
> general form. I have a Python program that launches a GUI
> application in a separate window via COM. I am using Python
> 2.1.1 with win32 extensions in MS-Windows (win95/98/NT)
>
> Is it possible to suspend the main Python program until the
> COM application has finished? (has been closed).
You really need to use COM Events. Look at either the documentation for
the app, or the makepy generated file for the app, and you may find the
app reports significant events - the MS Office apps do, for example.
For info on Python and COM Events, do:
>>> import win32com.client
>>> print win32com.client.DispatchWithEvents.__doc__
> I want to resume from that point onwards. How the main
> program gets information of the state of other applications
> launched from it?
You will probably need to implement your own loop (or "wait" call) here.
It depends on your app, but the most brute-force would be to create a
threading.Event object and have the main code wait for the
threading.Event, while the COM event handler sets the event.
Mark.
More information about the Python-list
mailing list