Sign in to follow this  
Followers 0
DelioPontes

Do, Until...The loop dont repeat....and I dont know why!

5 posts in this topic

Hi all

 

I need  your help again...

 

For some reason the script dont repeat the loop if can not find, one of the error dialog boxes...

 

for example if the script can not find the error 50, the script stops on the last action before, in this case on error 18

 

But I need the script restart again after error 18 or 50 (press again save and look again for new errors...)

 

And stops only when find the.dialog box "Successfully saved shared data to revision".

 

Can someone help me?

 

 

 

 

 

this is the code until now:

 

#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $sAnswer = InputBox("BUZ OFF!!!", "Project name?", "" , "") & ""
Do
Local $hWnd = WinWait($sAnswer)
WinSetState($hWnd, "", @SW_SHOWNORMAL)
if WinExists("Colorize scan"& "") then
WinWaitClose("Colorize scan"& "")
endif
if WinExists("Saving shared data...") then
WinWaitClose("Saving shared data...")
EndIf
IF WinExists($sAnswer) Then
Send("^s")
EndIf
WinWaitActive("Share Changes")
if WinExists("Share Changes") then
ControlClick("Share Changes", "", "[CLASS:Button; INSTANCE:1]")
endif
WinWaitActive ("SCENE","Saving shared data failed! Error Code: 18.")
if WinExists("SCENE","Saving shared data failed! Error Code: 18.") then
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
EndIf
WinWaitActive ("SCENE","Saving shared data failed! Error Code: 50.")
if WinExists("SCENE","Saving shared data failed! Error Code: 50.") then
ControlClick("SCENE", "", "[CLASS:Button; INSTANCE:1]")
EndIf
Until WinExists("SCENE", "Successfully saved shared data to revision" & "")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If no window appears matching the specified criteria WinWaitActive ("SCENE","Saving shared data failed! Error Code: 18.") , the script will hang until that window does appear. This could be what is happening. If that window does not appear, you will never reach the end of the loop.

Edited by czardas

Share this post


Link to post
Share on other sites

Hi czrdas,

Thanks for the tip, I will try to solve the problem without that expression

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The same applies for any call to WinWaitActive(). The script will wait for each window. It is unlikely that both error codes (18 & 50) will occur. I suggest you try to rewrite your code and also check out the following functions in the help file: ExitLoop & ContinueLoop.

Edited by czardas

Share this post


Link to post
Share on other sites

It works!

Thanks a lot!

1 person likes this

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