Sign in to follow this  
Followers 0
bigal12

Help with repeat loop

4 posts in this topic

#1 ·  Posted (edited)

hi i am new to autoit and need a bit of help with my script, where you see **************** is the part that needs to be repeated and the number of times is at the end of the *******************

any help would be grate

cheers :bye:

Func exitthescript()

Exit

EndFunc

HotKeySet( "q", "exitthescript" )

While

;Dim $box[4] = [0, 0, 10, 10]

;MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

;0, 0 = the x,y value of the top left hand corner of the box 10, 10 = the x,y value of the bottom right hand corner of the box

MouseClick("left",83,44)

Sleep(20000);20seconds

MouseClick("left",1260,195)

Sleep(20000);20seconds

Dim $box[4] = [1454, 290, 1568, 303]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [878,206,1001,228]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [979,401,1075,430]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [627,551,682,606]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [880,743,993,766]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

**********************************************************************24

Dim $box[4] = [766,646,895,668]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000 , 15000 )) ;10000, 15000=10 seconds, 15 seconds

*********************************************************************

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [878,206,1001,228]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [981,642,1073,669]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

Dim $box[4] = [880,743,993,766]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000, 30000 )) ;10000, 30000=10 seconds, 30 seconds

**********************************************************34

Dim $box[4] = [766,646,895,668]

MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))

Sleep (Random ( 10000 , 15000 )) ;10000, 15000=10 seconds, 15 seconds

*****************************************************************

Send("{space}",0)

Sleep (Random ( 3540000 , 3780000 )) ;3540000, 3780000=59mins, 63mins

WEnd

Edited by bigal12

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can use a for loop:

For $i = 1 To 24
    Dim $box[4] = [766,646,895,668]
    MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))
    Sleep (Random ( 10000 , 15000 )) ;10000, 15000=10 seconds, 15 seconds
Next

For $i = 1 To 34
    Dim $box[4] = [766,646,895,668]
    MouseClick("left", Random($box[0], $box[2]), Random($box[1], $box[3]))
    Sleep (Random ( 10000 , 15000 )) ;10000, 15000=10 seconds, 15 seconds
Next
Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

thanks for the help but i get seem to get

While

While^ ERROR

>Exit code: 1 Time: 0.312

Share this post


Link to post
Share on other sites

never mind forgot to put while 1 at the top lol

works a treat :thumbsup:

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