Jump to content

How Would I Loop Two Seperate Do Functions?


Recommended Posts

HotKeySet("{F9}","myExit")
Local $i = 0
Local $u = 0

HotKeySet("{ENTER}","SendEnter")


Do

WinActivate("WINDOW 1")

   sleep(2000)
    MouseClick("left", 912, 374)
    sleep(32500)

   MouseClick("left", 1026, 48)
   MouseClick("left", 81, 83)
   sleep(5000)

    MouseClick("left", 801, 854)


$i = $i + 1

Until $i = 30
Do

   sleep(5000)
   WinActivate("WINDOW 2")
   MouseClick("left", 372, 241)
   MouseClick("left", 388, 240)
   Send("{ENTER}")
   sleep(9000)
   WinActivate("WINDOW 1")
   MouseClick("left", 737, 61)
   $u = $u + 1

Until $u = 1

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

Basically I want it to do the action untill it reaches 30, then do the second action once, then loop this process infinitely. Thanks in advance.

Link to comment
Share on other sites

Then you should put your two "Do ... Until" in a While loop, like this :

HotKeySet("{F9}","myExit")
Local $i = 0
Local $u = 0

HotKeySet("{ENTER}","SendEnter")

While 1 ; repeat it forever

  Do

  WinActivate("WINDOW 1")

     sleep(2000)
      MouseClick("left", 912, 374)
      sleep(32500)

     MouseClick("left", 1026, 48)
     MouseClick("left", 81, 83)
     sleep(5000)

      MouseClick("left", 801, 854)


  $i = $i + 1

  Until $i = 30
  Do

     sleep(5000)
     WinActivate("WINDOW 2")
     MouseClick("left", 372, 241)
     MouseClick("left", 388, 240)
     Send("{ENTER}")
     sleep(9000)
     WinActivate("WINDOW 1")
     MouseClick("left", 737, 61)
     $u = $u + 1

  Until $u = 1
  
WEnd ; End of the infinite While loop

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

I did not test it, but it should do what you want.

Link to comment
Share on other sites

HotKeySet("{F9}","myExit")
Local $i = 0
Local $u = 0

HotKeySet("{ENTER}","SendEnter")

While 1 ; repeat it forever

  Do

     WinActivate("WINDOW 1")

     sleep(2000)
     MouseClick("left", 912, 374)
     sleep(32500)

     MouseClick("left", 1026, 48)
     MouseClick("left", 81, 83)
     sleep(5000)

     MouseClick("left", 801, 854)


  $i += 1

  Until $i = 30

  sleep(5000)
  WinActivate("WINDOW 2")
  MouseClick("left", 372, 241)
  MouseClick("left", 388, 240
  Send("{ENTER}")
  sleep(9000)
  WinActivate("WINDOW 1")
  MouseClick("left", 737, 61)

  
WEnd ; End of the infinite While loop

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

 

Link to comment
Share on other sites

HotKeySet("{F9}","myExit")
HotKeySet("{ENTER}","SendEnter")

While 1 ; repeat it forever
    $i = 0
  Do
    
     WinActivate("WINDOW 1")

     sleep(2000)
     MouseClick("left", 912, 374)
     sleep(32500)

     MouseClick("left", 1026, 48)
     MouseClick("left", 81, 83)
     sleep(5000)

     MouseClick("left", 801, 854)


  $i += 1

  Until $i = 30

  sleep(5000)
  WinActivate("WINDOW 2")
  MouseClick("left", 372, 241)
  MouseClick("left", 388, 240)
  Send("{ENTER}")
  sleep(9000)
  WinActivate("WINDOW 1")
  MouseClick("left", 737, 61)

  
WEnd ; End of the infinite While loop

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

yeah sorry, i copy and pasted straight back into forum and didn't test. thanks. i have made the changes to correct the mistake.

Edited by joboy2k
Link to comment
Share on other sites

5 hours ago, joboy2k said:
HotKeySet("{F9}","myExit")
HotKeySet("{ENTER}","SendEnter")

While 1 ; repeat it forever
    $i = 0
  Do
    
     WinActivate("WINDOW 1")

     sleep(2000)
     MouseClick("left", 912, 374)
     sleep(32500)

     MouseClick("left", 1026, 48)
     MouseClick("left", 81, 83)
     sleep(5000)

     MouseClick("left", 801, 854)


  $i += 1

  Until $i = 30

  sleep(5000)
  WinActivate("WINDOW 2")
  MouseClick("left", 372, 241)
  MouseClick("left", 388, 240
  Send("{ENTER}")
  sleep(9000)
  WinActivate("WINDOW 1")
  MouseClick("left", 737, 61)

  
WEnd ; End of the infinite While loop

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

yeah sorry, i copy and pasted straight back into forum and didn't test. thanks. i have made the changes to correct the mistake.

 

4

This does not work either it gives a parsing error at line 19.

Link to comment
Share on other sites

16 minutes ago, Swisss said:

This does not work either it gives a parsing error at line 19.

sorry once again :) I'm having a bad day, thought i would try and help but i keep getting it wrong :), i have taken the time and put it in to scite and this fully works for me

HotKeySet("{F9}","myExit")
HotKeySet("{ENTER}","SendEnter")

While 1 ; repeat it forever
    $i = 0
  Do
     WinActivate("WINDOW 1")
     sleep(2000)
     MouseClick("left", 912, 374)
     sleep(32500)
     MouseClick("left", 1026, 48)
     MouseClick("left", 81, 83)
     sleep(5000)
     MouseClick("left", 801, 854)
     $i += 1
  Until $i = 30

  sleep(5000)
  WinActivate("WINDOW 2")
  MouseClick("left", 372, 241)
  MouseClick("left", 388, 240)
  Send("{ENTER}")
  sleep(9000)
  WinActivate("WINDOW 1")
  MouseClick("left", 737, 61)
  
WEnd ; End of the infinite While loop

Func myExit()
   msgbox(0,"Exiting program","Good Bye!")
   Exit
EndFunc

Func SendEnter()
    Msgbox(0,"test","test")
EndFunc

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...