waiting for a name-less window to close

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nostra
Newbie
Posts: 2
Joined: Tue Mar 22, 2005 2:44 pm

waiting for a name-less window to close

Post by nostra » Tue Mar 22, 2005 2:57 pm

Hi,

I'm new to this and have been looking this board for several hours but I'm having problems with a name-less window.

THis is the situation: I want to automate the export of data to a textfile. After giving some information (in a Window with title "Formatted Export"), I press the "Export..." button. This brings up a second window with the title "Export file" where I specify the filename, filetype, location. I press the OK button and the "Export file" window closes (The "Formatted Export" window stays open) and a new window will open with no title but with a progressbar, cancel button and a label which initially says "Exporting the data" and changes to "Creating file..." when the export is completed. After the file is created, the name-less window closes and the "Formatted Export" window becomes active.At that point, the script needs to resume to do a new export with different data.

But I don't know how to wait for this nameless window to close. I tried to use WaitWindowOpen>Formatted Export but this doesn't work. The script won't wait for the progress window to finish.

Any help is much appreciated.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Mar 22, 2005 6:29 pm

Does this work:

WaitWindowClosed>Export File
WaitWindowOpen>

i.e. null string at the end.

Or:

WaitWindowClosed>Export File
WaitWindowChanged>0

This will wait for the foreground window to change after the Export File window has closed. So we don't care what it is called, we just wait for a new window. Some experimentation may be required but something along those lines should help.

Another way is to wait for a pixel color or rectangle to change (WaitPixelColor, WaitRectChanged) or if the window is a different size use a loop with GetActiveWindow in it waiting for the X,Y values to change.

Or set WIN_USEHANDLE to 1 and use a GetActiveWindow function in a loop waiting for the window handle to change. May need to do it twice if there is a delay between each window and the desktop or app's main window is briefly the active window between them.

Or use FindWindowWithText looking for a piece of detectable text that only appears on the new window. This may work if there is a unique bit of text that is detectable on the new window.

There are likely to be other solutions. I'm sure others will chip in with ideas I may have missed, but hopefully this gives you some ideas to experiment with.
MJT Net Support
[email protected]

nostra
Newbie
Posts: 2
Joined: Tue Mar 22, 2005 2:44 pm

Post by nostra » Wed Mar 23, 2005 7:09 am

The second one is working (with the WaitWindowChanged>0)
I clearly overlooked this one in the help. :oops:

Thanks!!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts