Jump to content

Want my script to start at line 1 when it gets to the end


Recommended Posts

I want my simple script to continue running from the beginning when it reaches the end. A never ending loop that keeps cycling thru until I cancel the process. I've searched help for some time but didn't come across what I thought would do this. Is there a command I can put at the end to get it to start over again? Obviously just learning and need a small bit of help. Thanks.

#NoTrayIcon

sleep(7000)

winActivate("blah blah")

sleep(5000)

MouseClick("right", 850, 550)

sleep(120000)

Send("s", 1)

MouseClick("right", 850, 550)

sleep(120000)

Send("w", 1)

Link to comment
Share on other sites

Cryn's idea will work

you could also go with a While ... WEnd loop

#NoTrayIcon

; Set a hotkey to exit:
HotKeySet("{ESC}", "Terminate")

While 1 ; start the loop
    sleep(7000)
    winActivate("blah blah")
    sleep(5000)
    MouseClick("right", 850, 550)
    sleep(120000)
    Send("s", 1)
    MouseClick("right", 850, 550)
    sleep(120000)
    Send("w", 1)
WEnd ; end the loop

; Function that the HotKey calls to:
Func _MyExit()
    exit
EndFunc ;==> _MyExit()

Cheers

/tAK

Link to comment
Share on other sites

#NoTrayIcon
HotKeySet("{ESC}", "Terminate")
$times = InputBox("Times","How many times you want script repeat?","1")
If @error then exit
For $i = 1 to $times
sleep(7000)
winActivate("blah blah")
sleep(5000)
MouseClick("right", 850, 550)
sleep(120000)
Send("s", 1)
MouseClick("right", 850, 550)
sleep(120000)
Send("w", 1)
next
Func Terminate()
Exit
EndFunc

Use this for defined times to run the loop.

i542

Edited by i542

I can do signature me.

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...