Sign in to follow this  
Followers 0
wisem2540

Help with while loop

6 posts in this topic

I think my DO, UNTIL's are causing me issues here.  But I cannot figure it out.

The idea here is to watch for one of 3 windows...  find it...do stuff, wait for it to disappear, then start over

While 1

Do
   Sleep (250)
   Until  WinActive ("Untitled - Notepad", "Window1") or  WinActive ("Untitled - Notepad", "Window2") or  WinActive ("Untitled - Notepad", "Window1")



If WinActive ("Untitled - Notepad", "Window1") Then
   MsgBox (0, "Window1", "Found")
   Do
      Sleep (250)
   Until WinActive ("Untitled - Notepad", "Window1") = 0
   ContinueLoop ; Start while loop over





If WinActive ("Untitled - Notepad", "Window2") Then
   MsgBox (0, "Window1", "Found")
   Do
      Sleep (250)
   Until WinActive ("Untitled - Notepad", "Window2") = 0
    ContinueLoop ; Start while loop over


If WinActive ("Untitled - Notepad", "Window3") Then
   MsgBox (0, "Window1", "Found")
   Do
      Sleep (250)
   Until WinActive ("Untitled - Notepad", "Window3") = 0
    ContinueLoop ; Start while loop over

  WEnd

Share this post


Link to post
Share on other sites



omg...  I cannot believe I left those...

Share this post


Link to post
Share on other sites

You have 2 "window1" and no "window3" in this line...

Until  WinActive ("Untitled - Notepad", "Window1") or  WinActive ("Untitled - Notepad", "Window2") or  WinActive ("Untitled - Notepad", "Window1")

Share this post


Link to post
Share on other sites

Yeah I noticed a few typos in there...  its working now after the ENDifs...

I apologize for my stupidity..  Thanks for the help...

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