Sign in to follow this  
Followers 0
whatever

loop?

3 posts in this topic

i want to make a very simple loop

it should first wait 30 seconds, then press the button P

i looked at the helpfile about looping..and it was confusing..this is what it looks like:

$i = 0
While $i <= 10
    MsgBox(0, "Value of $i is:", $i)
    $i = $i + 1
WEnd

And what i want to do is just:

Loop this

Sleep(30000)

send("p")

forever

How do i type this then?

Whats the meaning of "$i" ? I mean i know its a variable..but how does it work?

Are there any pages where i can learn more about variables?

Do i have to make variables to create loops?

Share this post


Link to post
Share on other sites



While 1
    Sleep(30000)
    Send("p")
WEnd



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Beated by BigDod :lmao:

Loop forever could be:

While 1
Sleep(30000)
Send("p")
WEnd

Meaning of $i in script:

in the beginning you give $i a value of 0

in the while statement you say: WHILE $i is not 10 give a nice msgbox...

and everytime you get a msgbox.. $i will be rased with 1, and the script wil start over again.

summary: $i=0, msgbox, $i=1, msgbox... $i=9, msgbox, $i=10, EXIT

It is usefull to use variables in loops indeed ;) it's easier to read

Neo

Edited by NeoFoX

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

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