Sign in to follow this  
Followers 0
evilelf

how would i loop it?

12 posts in this topic

Hello i forgot how to make a scrip restart.

I am maken this scip after its all done doing what needs to be done it will restart.

But i just forgot. I cant find it i know i Ran in to it here.


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

a script restart?

Perhaps putting the code you want to restart inside a loop:

;Loop forever
While 1
;Put code here
Wend

;Loop 50 times
For $i = 1 to 50
;Put code here
Next

;Loop 10 times
Local $i = 1
Do
$i+= 1
;Put code here
Until $i = 10

There are many ways..

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

;Loop forever

While 1

;Put code here

Wend

thats what i need i did this and it gives me errors. Thats why i thought i was doing it wrong.


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What are the errors you are getting?

and also what is the code you are using...?

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

;Loop forever

While 1

;Put code here

Wend

thats what i need i did this and it gives me errors. Thats why i thought i was doing it wrong.

It's more than likely the ";Put code here" giving you errors. Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

while 1 ;Don't forget the 1! or any other expression your evaluating.
send("1")
send("1")
send("1")
send("1")
send("1")
sleep(10000)
send("1")
send("1")
send("1")
send("1")
send("1")
wend
endif
A complete example would be nice, not even Chris's would work with that EndIf at the end of WEnd.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

well i got it done but now i am stuck on a little problem.

I cant get it to Do a Random Pick.

i need it to pick up to 8 items random a sleep time.

But i cant i tryed.

If Random() < 2.0 Then
    $sleep = Sleep(8000)
Else

    $sleep = Sleep(7000)
Else
    $sleep = sleep(6000)
Else

     $sleep = Sleep(300000)
    Else
     $sleep = sleep(2000)
Else

    $sleep = Sleep(200000)
Else

   $sleep = Sleep(5000)
Else

     $sleep = Sleep(150000)
Endif
$sleep

But this does not work. am i close at all???

Edited by evilelf

Share this post


Link to post
Share on other sites

well i got it done but now i am stuck on a little problem.

I cant get it to Do a Random Pick.

i need it to pick up to 8 items random a sleep time.

But i cant i tryed.

If Random() < 2.0 Then
    $sleep = Sleep(8000)
Else

    $sleep = Sleep(7000)
Else
    $sleep = sleep(6000)
Else

     $sleep = Sleep(300000)
    Else
     $sleep = sleep(2000)
Else

    $sleep = Sleep(200000)
Else

   $sleep = Sleep(5000)
Else

     $sleep = Sleep(150000)
Endif
$sleep

But this does not work. am i close at all???

Might want to check the help file on how to use Random().

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

$random_number = random(10, 100, 1)
if ($random_number <= 50) Then
sleep($random_number*2)
else
sleep($random_number/2)
endif

What will help you through programming ALOT! is to look for a syntax tutorial. It will help you understand why multiple else state statements under 1 if statement does'nt work :lmao:

Just a suggestion.

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Ok thnx man!!!!!

Edited by evilelf

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