Jump to content

Looping?


On22s
 Share

Recommended Posts

yeah i read help files and all this and that, did 1-2-3

i got everything just about ready, all i want to do is repeat that maybe set a hotkey that's it

MouseMove(470,471)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(471,516)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(488,474)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(480,516)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(483,466)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(481,517)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(479,514)
Sleep(10000)
MouseClick(1)
MouseDown("left")
MouseUp("left")
MouseMove(482,469)
Sleep(10000)
MouseClick(1)
Link to comment
Share on other sites

Something like this:

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F4}", "_DoIt")
While 1
    Sleep(10) ; keeps it from using 100% CPU
WEnd

Func _DoIt()
    MouseMove(470, 471)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(471, 516)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(488, 474)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(480, 516)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(483, 466)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(481, 517)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(479, 514)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(482, 469)
    Sleep(10000)
    MouseClick(1)
EndFunc   ;==>_DoIt

Func Terminate()
    Exit
EndFunc   ;==>Terminate

[Edit] typo

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

MouseClick(1) is not the proper syntax.

Edit1: That line, written that way, does nothing.

MouseClick("left") will click one time by default.

If the "1" that you specified is the number of clicks, you cannot skip the parameters in front of the "number of clicks" parm.

MouseClick("button", x, y, clicks, speed)

You may be able to replace these lines of code:

MouseMove(470,471)

Sleep(10000)

MouseClick(1)

MouseDown("left")

MouseUp("left")

with

Sleep(10000)

MouseClick("left", 470, 471, 1, 100)

enjoy AutoIt

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

thanks :):D:D how do i make it repeat forever like start it and then later on when i chose it stop it

Like this:

HotKeySet("{ESC}", "Terminate")
While 1
    MouseMove(470, 471)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(471, 516)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(488, 474)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(480, 516)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(483, 466)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(481, 517)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(479, 514)
    Sleep(10000)
    MouseClick(1)
    MouseDown("left")
    MouseUp("left")
    MouseMove(482, 469)
    Sleep(10000)
    MouseClick(1)
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

You should really consider herewasplato's suggestion about using less code though

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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