Jump to content

Need A Script To Mouseclick wherever I leave the mouse every 'x' seconds


Recommended Posts

  • Moderators

Hey everyone, I was wondering if there was a way so I can move my mouse, say on a button, and run the script and it will automatically click on the button every 'x' seconds. I really dont need it to find a place to click or anything, just click.

http://www.autoitscript.com/autoit3/docs/functions.htm (You'd be amazed at what you find using the exact terms you are using above). Check out ControlClick().

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

You would have to constantly get the position of the cursor (try using MouseGetPos) , then have it keep track of the time (search the help file for time, you'll get a bunch of commands), then have a MouseClick command click where the position of the mouse you record is when it's the right time.

EDIT: Or you can try the easier way that Sm0ke_N gave :)

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Well I got this to click for me, I just need to know how to make it do it over and over, it does it once fine, but it just stops after

; Double click at the current mouse pos

MouseClick("left")

MouseClick("left")

Put it in a loop, with a sleep command

While 1
    MouseClick("left")
    MouseClick("left")
    Sleep(2000) ; Wait 2 seconds
WEnd
Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Put it in a loop, with a sleep command

While 1
    MouseClick("left")
    MouseClick("left")
    Sleep(2000) ; Wait 2 seconds
WEndoÝ÷ Ûú®¢×ºÛaȬj¢Ú,¶hDz¢çhÁ©íÛh¡«"¶+¢{-j{eÉÉbrH§Þr¦zwZuاØb±«­¢+Ø)!½Ñ­åÍÐ ÅÕ½ÐííM
ôÅÕ½Ðì°ÅÕ½ÐíEÕ¥ÐÅÕ½Ðì¤)]¡¥±Ä(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì¤(%M±À ÈÀÀÀ¤ì]¥ÐÈͽ¹Ì)]¹)Õ¹EեР¤)á¥Ð)¹Õ¹(

Now pushing ESC makes it stop.

Link to comment
Share on other sites

instead of using sleep you can use my timer functions.. It will call your "Click" function every x seconds..

http://www.autoitscript.com/forum/index.php?showtopic=40177

here is an example:

#include "timer.au3"
Func _Click()
    ;Put the code here that you want to execute every x seconds(clicking the mouse)
    ;use controlclick to click your Control
    
EndFunc

$timer = _TimerCreate("_Click", 1000) ;calls _Click every second
while(true)
    _TimerUpdate($timer)
WEnd
Link to comment
Share on other sites

Lol, i knew there were better ways to make it stop/pause, but my way was quick and beat having no stopping at all. :)

You could/should add a hotkey/exit (like yours) to the GUI in that link to kill it when using subsecond click rates.

...or is there another way to kill it that I'm not seeing in the code? Alt-F4 won't work unless you can get the GUI into focus between clicks (assumes that you are not clicking on the GUI itself :-).

..but if the goal is AFK clicks 20 to 30 seconds apart, then you have enough time to move the mouse and stop the script via the existing GUI code.

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

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