Sign in to follow this  
Followers 0
soum

How to wait for a modal window to close

11 posts in this topic

Hi All!

I am a new user of AutoIt. I am trying to use AutoIt to Automate a Wizard. The wizard is having a form. I can successfully fill all the text boxes of that form using the auto-it ;) . But when I Click on OK of that window, the form opens a modal dialog box and processes the information.

I need to wait for this modal window to close.

I tryied to use the WinWailClose("Window Title") function. But Autoit is not waiting for the dialog to close. It continues executing the script.

I used WinExists("Window Title") function. It returned 0 even the dialog exist. :P

Can any one please tell me how to use AutoIt to deal with this situation?

Thanks A lot in advance.

Regards

Soum

Share this post


Link to post
Share on other sites



What happens after the dialog box processes the information. Does another box popup or anything. If yes you may be able to use WinWaitActive. Failing that let us know what you are trying to install as someone may already have experience with it.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

try to use "AU3Inof.exe" it is in you autoit folder

just maybe it could show some info on that window

if it does press "alt + Print scrren" to grab a pic of it and post it here

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

What happens after the dialog box processes the information. Does another box popup or anything. If yes you may be able to use WinWaitActive. Failing that let us know what you are trying to install as someone may already have experience with it.

I have tried to use WinWaitActive. But it is giving me the following error:

"Run-Time error 401 : Can't show non-modal form when modal form is displayed"

After this the application is crashing. This error neve comes when I do the same steps manually. ;)

Please Help

Regards

Soum

first wait for the window... then wait for it to close...

Lar.

Auto-it is not able to detect the modal window(because WinExists returns 0). I am not sure how to wait for the window.

please help

Soum

Share this post


Link to post
Share on other sites

you could try a large "sleep" function 1000 = 1 second

Sleep(7000) ; wait 7 seconds

**********

or show us the script and a pic of the window in question

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

do you mean a multiple document interface (MDI) window?

Lar.

No It is a Single document window.

Soum

Share this post


Link to post
Share on other sites

you could try a large "sleep" function 1000 = 1 second

Sleep(7000) ; wait 7 seconds

**********

or show us the script and a pic of the window in question

8)

This is the Window I am Trying to AUTOMATE.

This is the error I am getting.

I use The Following Code to Wait for the window called "Verifying Security".

$ret=WinWaitClose("Verifying Security","",60000)

MsgBox(0, "AutoIt", $ret)

I Tried the other options specified by the you also. Like WinWaitActive("Add Computer") [This is the parent Window]

Please help

Thanks & Regards

Soum

Share this post


Link to post
Share on other sites

Can you use WinGetState on the offending window, if so you may be able to use this to check when the window is not active.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

ok... it looks like its verifying and (to me [just guessing]) will close after verification and i do not think AU3Info can't get a Control from this type of GUI

So

1

you could use a sleep as i suggested before

Sleep(10000) ; sleeps for 10 seconds

if you can wait it out

2

you could check

ProcessExit()

before and after to try to find a process that runs when this box comes up... then use

While 1

if Not processexist(" ? the process name ? ") Then

ExitLoop

Endif

Sleep(20)

Wend

3

You could wait for this box to complete

( like i said... i am gussing it does complete with no user action needed)

and then see which control on your original GUI is given focus. The use AU3Info tool to get the control info and use a control command like

While 1

If ControlCommand(" bla ", " bla ", "", " Is Enabled") Then

ExitLoop

Endif

Wend

to wait for " Is Enabled"

Check help on these features for the correct control

hope that helps..... i know you are trying.... and we respect people who try

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Try using "Opt("WinSearchChildren", 1)" as the modal window is a child window of the top-level parent.

Share this post


Link to post
Share on other sites

Hi ,

I have found from the MSDN (http://msdn.microsoft.com/library/default....modcantshow.asp) that the cause of is error is the show or set visiable property of the non-modal form.

When we call WinWaitClose or any other WinWait... functions on a modal window, does auto-it calls the show or visiable property of the non-modal forms?

My question is how it itarate through all the windows. Does it call the show or Set visiable property of all the existing windows to find out whether they are visiable?

Thanks a lot for your help.

waiting for your reply

Regards

Soum

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0