Jump to content

Repeating Script


Recommended Posts

trying to get the mouseclick to repeat without coping 100 of these:

MouseClick ( "left" ,$relistwindowx,$relistwindowy,1,1 )

Sleep(1000)

MouseClick ( "left" ,$relistbuttonx,$relistbuttony,1,1 )

Sleep(1000)

is there a command to repeat just this string?

code

Global $Paused

HotKeySet("{ESC}", "Terminate")

Opt("MouseClickDragDelay", 100)

Sleep("100")

#include <Misc.au3>

SplashTextOn("Auto Relist Setup", "Please Click on the first Item in the relist window (red)", 400, 100, -1, -1, 1, "Ariel", 15)

While 1

Sleep ( 100 )

If _IsPressed("01") Then

$getpos = MouseGetPos()

ExitLoop

EndIf

WEnd

SplashOff()

$relistwindowx = $getpos[0]

$relistwindowy = $getpos[1]

Sleep ( 1000 )

SplashTextOn("Auto Relist Setup", "Please Click on the relist button tab (blue)", 400, 100, -1, -1, 1, "Ariel", 15)

While 1

Sleep ( 100 )

If _IsPressed("01") Then

$pos = MouseGetPos()

ExitLoop

EndIf

WEnd

SplashOff()

$relistbuttonx = $getpos[0]

$relistbuttony = $getpos[1]

Sleep ( 1000 )

while 1

MouseClick ( "left" ,$relistwindowx,$relistwindowy,1,1 )

Sleep(1000)

MouseClick ( "left" ,$relistbuttonx,$relistbuttony,1,1 )

Sleep(1000)

WEnd

Func Terminate()

Exit 0

EndFunc

Link to comment
Share on other sites

  • Moderators

For $i = 1 To 100
    MouseClick ( "left" ,$relistwindowx,$relistwindowy,1,1 )
    Sleep(1000)
    MouseClick ( "left" ,$relistbuttonx,$relistbuttony,1,1 )
    Sleep(1000)
Next
It's called a loop (you have a some (loops ie... For/Next|While/WEnd|Do/Until) already in your script...).

You may also want to look at adding code tags ([ code]code here[ /code] or [ AutoIt]code here[ /AutoIt] (without spaces)) to your code when posting.

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.

Link to comment
Share on other sites

For $i = 1 To 100
    MouseClick ( "left" ,$relistwindowx,$relistwindowy,1,1 )
    Sleep(1000)
    MouseClick ( "left" ,$relistbuttonx,$relistbuttony,1,1 )
    Sleep(1000)
Next
It's called a loop (you have a some (loops ie... For/Next|While/WEnd|Do/Until) already in your script...).

You may also want to look at adding code tags ([ code]code here[ /code] or [ AutoIt]code here[ /AutoIt] (without spaces)) to your code when posting.

tks got it to work 8P

just wondering what $i is,and does Next bring it back to For?

Link to comment
Share on other sites

In the case of a FOR loop, the loop starts with the For statement and sets a variable (in this case $i, but can be another variable) then it will repeat from the next back up to the for. It will continue until the max setting is reached. A While loop will repeat while a condition is true. A Do loop will repeat until a condition is true. Loops are a wonderful thing to learn in programing and enable it to be more powerful. For details, try out the samples in the help file. Good luck.

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