Jump to content

How can I loop this script?


 Share

Recommended Posts

I downloaded a .exe somebody created with autoit in which automates everything as you go, creating a .au3 file when you're finished so you can re-trace your moves and it automates all you did when you open it.

When I go "Edit" the script, I get the code:

Sleep(2000)

MouseClick("left",486,752,1)
Sleep(2337.78930003674)

MouseClick("left",368,210,1)
Sleep(2246.98111072776)
MouseClick("right",345,649,1)
Sleep(3484.61801709435)
Send("{LCTRL}")
Sleep(711.176979197077)
MouseClick("left",284,497,1)
Sleep(202.990882919477)
MouseClick("left",176,452,1)
Sleep(1038.98819542707)
MouseClick("left",176,452,1)
Sleep(1068.56066902358)
MouseClick("left",176,452,1)
Sleep(948.730634759446)
MouseClick("right",620,466,1)
Sleep(1055.64617849475)
MouseClick("left",772,261,1)
Sleep(564.872909825131)
MouseClick("right",774,262,1)
Sleep(586.408887163033)
MouseClick("left",673,141,1)
Sleep(611.438883992239)
MouseClick("right",576,138,1)
Sleep(570.483399426463)
MouseClick("left",377,118,1)
Sleep(676.397139859954)
MouseClick("right",377,118,1)
Sleep(455.25814035024)
MouseClick("left",300,283,1)
Sleep(830.602772140035)
MouseClick("right",308,357,1)
Sleep(743.217364218078)
Send("{CTRLUP}{F1}")
Sleep(1524.85329839407)
Send("{F5}")
Sleep(2053.22827342581)
MouseClick("left",582,469,1)
Sleep(2549.10638083891)
Send("{LSHIFT}")
Sleep(2491.76836720868)
Send("{SHIFTDOWN}{ALT}")
Sleep(300.845498520063)
Send("{SHIFTUP}{CTRLUP}{ALTUP}{LWINUP}{RWINUP}")

But I would like to loop this, rather than just have it play-over once. How can I do this? I've been trying at this for sometime now, thought I'd ask for some assistance. Thanks :)

Link to comment
Share on other sites

Maybe...

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        Sleep(2000)

        MouseClick("left", 486, 752, 1)
        Sleep(2337.78930003674)

        MouseClick("left", 368, 210, 1)
        Sleep(2246.98111072776)
        MouseClick("right", 345, 649, 1)
        Sleep(3484.61801709435)
        Send("{LCTRL}")
        Sleep(711.176979197077)
        MouseClick("left", 284, 497, 1)
        Sleep(202.990882919477)
        MouseClick("left", 176, 452, 1)
        Sleep(1038.98819542707)
        MouseClick("left", 176, 452, 1)
        Sleep(1068.56066902358)
        MouseClick("left", 176, 452, 1)
        Sleep(948.730634759446)
        MouseClick("right", 620, 466, 1)
        Sleep(1055.64617849475)
        MouseClick("left", 772, 261, 1)
        Sleep(564.872909825131)
        MouseClick("right", 774, 262, 1)
        Sleep(586.408887163033)
        MouseClick("left", 673, 141, 1)
        Sleep(611.438883992239)
        MouseClick("right", 576, 138, 1)
        Sleep(570.483399426463)
        MouseClick("left", 377, 118, 1)
        Sleep(676.397139859954)
        MouseClick("right", 377, 118, 1)
        Sleep(455.25814035024)
        MouseClick("left", 300, 283, 1)
        Sleep(830.602772140035)
        MouseClick("right", 308, 357, 1)
        Sleep(743.217364218078)
        Send("{CTRLUP}{F1}")
        Sleep(1524.85329839407)
        Send("{F5}")
        Sleep(2053.22827342581)
        MouseClick("left", 582, 469, 1)
        Sleep(2549.10638083891)
        Send("{LSHIFT}")
        Sleep(2491.76836720868)
        Send("{SHIFTDOWN}{ALT}")
        Sleep(300.845498520063)
        Send("{SHIFTUP}{CTRLUP}{ALTUP}{LWINUP}{RWINUP}")
    WEnd
EndFunc   ;==>ShowMe

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 9 years later...

can someone loop my script too please :
WinActivate("untitled")
Sleep(250)
MouseClick("left",1304,348)
For $x = 1 to 55
   Send("{A down}")
   Sleep(100)
   Send("{A up}")
   Sleep(100)
   Send("{RIGHT down}")
   sleep(100)
   Send("{RIGHT up}")
Next
For $x = 1 to 55
   Send("{A down}")
   Sleep(100)
   Send("{A up}")
   Sleep(100)
   Send("{LEFT down}")
   sleep(100)
   Send("{LEFT up}")
Next
 

Link to comment
Share on other sites

  • Moderators

@ieatmemes welcome to the forum. First off, the forum (unlike 9 years ago when this post originated) operates under the "Teach a Man to Fish" motto. We are here to help, but it is not a place where you put in a request and someone just barfs up the code for you. So, to begin (if you want to actually learn how to do it rather than relying on someone else to write it for you):

  • How about a detailed description of what exactly you are trying to do? You're using MouseClicks, Sends, and Sleep - which is generally the least consistent and reliable way to do anything. If we know exactly what you're trying to accomplish, we can assist with showing you a better way (and there IS a better way, I can see that much already).
  • Make sure you actually do some reading in the help file - I am amazed at the number of folks that decide they can't be bothered with this step. Almost every function in the help file comes with at least one example, which shows you exactly how it should work. I would suggest you start off with reading the section Loop Statements to show you how to use For...Next, While...WEnd, and other loops.
  • Be prepared when you receive suggestions to show some effort. "It's broke" or "Nope, doesn't work" won't get you very far on this forum - you need to explain what you have tried on your own, what the expected result was (in detail) and what error code (if any) or behavior you saw.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 11 months later...
  • Developers

@PabloEscaliber, Welcome.

Did you read the last post in this thread before posting? 
Did you see the date on the  quoted post?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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