I would like to get at runtime a collection (or array) of all opened windows, then identify those which are dedicated to the tested application, this in order to close only concerned windows when closing the tested application.
Originally posted by JPB Tornier: this in order to close only concerned windows when closing the tested application.
<font size="2" face="Verdana, Arial, Helvetica">You do not need to get the collection of windows if you want to close the application. When you capture a click on a window (using the raw attach), you get something like this:
This will help you to create the following script:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
Dim appli As TApp
If Window("Application=MyAplication.EXE",tp AttachNoWait).Exist Then
'Application is opened: close it
Set appli = App("Application=MyAplication.EXE"
'The application is not opened, so do nothing
End If</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">This script will "kill" your application - a very useful thing in case of an error: this clears the place for the next test case.
The code that I provided in my previous post does not just close the main window. It kills the whole application, even the message asking you for firstly closing the childs [img]images/icons/smile.gif[/img] .