Sign in to follow this  
Followers 0
SweatyOgre

looping

5 posts in this topic

The way the help file puts it, and the example it uses, make me wonder how I can script this action I want to.

The helpfile says:

For <variable> = <start> To <stop> [Step <stepval>]
    statements
    ...
Next

Example

For $i = 5 to 1 Step -1

    MsgBox(0, "Count down!", $i)

Next

MsgBox(0,"", "Blast Off!")

I'd like to set it to loop my action a certain amount of times, would this be possible without the variable? Just set it to, say,

For = <start> To <stop>
    statements
    ...
Next

?

Share this post


Link to post
Share on other sites



for statements always confuse me, but u can always use a while...they seem easier. I'm not sure of a way to do without variables on the 'for' loop , but why not use them?


-Brett

Share this post


Link to post
Share on other sites

It'd just seem easier to me to not use them for this action. Here's the code I want it to repeat, I want it to do it 300 times. Maybe you could help me?

MouseMove(100, 1, 0)

$x = MouseGetCursor()

Do
$x = MouseGetCursor()
Sleep(500)
Until $x = 2
MouseClick ( "left", 594, 499 )
Sleep (100)
MouseClick ( "left", 648, 531 )
Sleep (100)
MouseClick ( "left", 503, 527 )
MouseMove(100, 1, 0)

$x = MouseGetCursor()

Do
$x = MouseGetCursor()
Sleep(500)
Until $x = 2
MouseClick ( "left", 422, 450 )

Share this post


Link to post
Share on other sites

Thanks to both of you.

Share this post


Link to post
Share on other sites

The variable keeps track of which time the loop you are in. You can read it to find out where you are.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

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