Swisss Posted May 26, 2016 Posted May 26, 2016 expandcollapse popupHotKeySet("{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.
Jules Posted May 26, 2016 Posted May 26, 2016 Then you should put your two "Do ... Until" in a While loop, like this : expandcollapse popupHotKeySet("{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. Swisss 1
Joboy2k Posted May 26, 2016 Posted May 26, 2016 You don't need the second Do Until loop, as its only once the while 1 loop will do it once then start the process again from the first Do Until loop. Swisss 1
Student_coder Posted May 26, 2016 Posted May 26, 2016 @_joboy2k Then how will it perfom the "2nd action". I think the way you suggested won't work. Forgive me if am wrong. Swisss 1
Joboy2k Posted May 26, 2016 Posted May 26, 2016 expandcollapse popupHotKeySet("{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 Swisss 1
Jules Posted May 26, 2016 Posted May 26, 2016 (edited) My mistake, I should have noticed that the second While was not necessary (because it's repeated only once ...). You did well by correcting me. Edited May 26, 2016 by Jules Swisss 1
AutoBert Posted May 26, 2016 Posted May 26, 2016 The script from joboy2k is also wrong, it works only in first loop correct. Assigning $i=0 after the While will correct this. Swisss 1
Joboy2k Posted May 26, 2016 Posted May 26, 2016 (edited) expandcollapse popupHotKeySet("{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 May 26, 2016 by joboy2k Swisss 1
Swisss Posted May 26, 2016 Author Posted May 26, 2016 5 hours ago, joboy2k said: expandcollapse popupHotKeySet("{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.
Joboy2k Posted May 26, 2016 Posted May 26, 2016 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 Swisss 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now