Sign in to follow this  
Followers 0
ninjalicious

Looping macros

8 posts in this topic

OK so this is my first script I've made, just basically a program made to sleep, click something 8 times then sleep again and repeat, however I can't get it to repeat.

This is what I have:

While 1

Sleep(7000)

MouseClick("left", 215, 212, 8, 1)

Sleep(11000)

Wend

However it doesn't repeat. I've probably done something really stupidly wrong, but be gentle! I've tried searching and that, but I guess i'm just thick :">

Any help would be GREATLY appreciated!

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

OK so this is my first script I've made, just basically a program made to sleep, click something 8 times then sleep again and repeat, however I can't get it to repeat.

This is what I have:

While 1

Sleep(7000)

MouseClick("left", 215, 212, 8, 1)

Sleep(11000)

Wend

However it doesn't repeat. I've probably done something really stupidly wrong, but be gentle! I've tried searching and that, but I guess i'm just thick :">

Any help would be GREATLY appreciated!

Thanks!

Maybe something like:

While 1
Sleep(11000)
For $i = 0 to 7
MouseClick("left", 215, 212, 8, 1)
Sleep(7000)
Next
WEnd

Not sure how you orignally wanted your sleep times to be. The way this is setup.. it will sleep for 11 seconds in between each group of mouseclicks. It will also sleep for 7 seconds inbetween each individual mouseclick. Modify it to what you want.

Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When you say it's not repeating, is the script actually terminating or does it look like it's just sitting there looping?

If you add this in at the top of your script, you can put your mouse over the tray icon and it will show you which line it's getting stuck at.

Opt ( "TrayIconDebug", 1 )
Edited by exodius

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Maybe something like:

While 1
Sleep(11000)
For $i = 0 to 7
MouseClick("left", 215, 212, 8, 1)
Sleep(7000)
Next
WEnd

Not sure how you orignally wanted your sleep times to be. The way this is setup.. it will sleep for 11 seconds in between each group of mouseclicks. It will also sleep for 7 seconds inbetween each individual mouseclick. Modify it to what you want.

Thanks, the script I posted is correct, it does work, it just doesn't loop.

Edit: It's running inside another program so I can't look at the tray, but it doesn't click when it's running again, it just runs once then stops I think.

I get the error "Next" statement with no matching "For" statement... whatever that means :D

Edited by ninjalicious

Share this post


Link to post
Share on other sites

Thanks, the script I posted is correct, it does work, it just doesn't loop.

Edit: It's running inside another program so I can't look at the tray, but it doesn't click when it's running again, it just runs once then stops I think.

I get the error "Next" statement with no matching "For" statement... whatever that means :D

If you put that Opt line at the top of the script that this snippet is running in, it should allow you to look at the tray icon still... If you run the script out of SciTE, as opposed to compiling it and running it, then the tray icon debug should also tell you what line it's getting hung up on...

As for that error message, because that For....Next loop is complete, it makes me think that you have an unpaired If statement or something like that somewhere above this snippet.

P.S. Could we get your whole code? (Dont' forget to use the Code tags when posting it. :D

Share this post


Link to post
Share on other sites

If you put that Opt line at the top of the script that this snippet is running in, it should allow you to look at the tray icon still... If you run the script out of SciTE, as opposed to compiling it and running it, then the tray icon debug should also tell you what line it's getting hung up on...

As for that error message, because that For....Next loop is complete, it makes me think that you have an unpaired If statement or something like that somewhere above this snippet.

P.S. Could we get your whole code? (Dont' forget to use the Code tags when posting it. :D

My whole code is:

WinWaitActive("xxx")
Sleep(7000)
MouseClick("left", 215, 212, 8, 1)
Sleep(9000)

I don't want to put the window name in as it's a game, haha.

It's really basic, that's all I need it to do, no pauses between mouse clicks or anything. It works perfectly when I activate it, it just doesn't loop and that's all I need it to do. :D

Share this post


Link to post
Share on other sites

Your code:

While 1
Sleep(7000)
MouseClick("left", 215, 212, 8, 1)
Sleep(11000)
Wend

What you wanted it to do:

Click something 8 times then sleep again and repeat, however I can't get it to repeat.

Thanks, the script I posted is correct, it does work, it just doesn't loop.

The code you provided does NOT do what you you said you wanted it to do. What your code does is infinately loop a Pause of 7 seconds, click , Pause 11 seconds. This is far from what you said. Take a closer look at what I posted.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

My whole code is:

WinWaitActive("xxx")
Sleep(7000)
MouseClick("left", 215, 212, 8, 1)
Sleep(9000)

I don't want to put the window name in as it's a game, haha.

It's really basic, that's all I need it to do, no pauses between mouse clicks or anything. It works perfectly when I activate it, it just doesn't loop and that's all I need it to do. :D

How about trying a different type of loop...

$x = 0
Do
WinWaitActive("xxx")
Sleep(7000)
MouseClick("left", 215, 212, 8, 1)
Sleep(9000)
Until $x = 1

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