Jump to content

Right mouse click repeatedly with delay?


Recommended Posts

I'm looking for a script/code that will right click wherever my cursur is repeatedly with delay in between each click.

Something like this... but with delay:

Do
MouseClick ("SECONDARY") 
Until _IsPressed ("21")
Poke a sleep in there...

Do
     MouseClick ("SECONDARY") 
     Sleep(500) ; 500ms = .5sec
Until _IsPressed ("21")

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Use Sleep(1), i bet you cannot make your click in that split second

It's still cancelling it out.

Here is my code:

#include <GUIConstants.au3>
#include <misc.au3>

#Region ### START Koda GUI section ### Form=
$Tester = GUICreate("Simple Clicker by Joshperson", 201, 151, 337, 222)
GUISetCursor (2)
GUISetBkColor(0xA6CAF0)
$Auto_Scatter = GUICtrlCreateCheckbox("Auto_Scatter", 56, 24, 97, 17)
GUICtrlSetBkColor(-1, 0xC0DCC0)
$Auto_Jumper = GUICtrlCreateCheckbox("Auto_Jumper", 56, 56, 97, 17)
GUICtrlSetBkColor(-1, 0xC0DCC0)
$Run = GUICtrlCreateButton("Run", 59, 115, 75, 25, 0)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Run
            If BitAND(GUICtrlRead($Auto_Scatter), $GUI_CHECKED) Then
            Do
     MouseClick ("SECONDARY") 
     Sleep(1); 1= .01sec
Until _IsPressed ("21")
                EndIf
            If BitAND(GUICtrlRead($Auto_Jumper), $GUI_CHECKED) Then
                Send("{LCTRL Down}")
Sleep(0); 0 seconds
Send("{LCTRL Up}")


            
            EndIf
    EndSwitch
WEnd

In this code, I'm trying to make it so that this

If BitAND(GUICtrlRead($Auto_Scatter), $GUI_CHECKED) Then
            Do
     MouseClick ("SECONDARY") 
     Sleep(1); 1= .01sec
Until _IsPressed ("21")
                EndIf

and this

If BitAND(GUICtrlRead($Auto_Jumper), $GUI_CHECKED) Then
                Send("{LCTRL Down}")
Sleep(0); 0 seconds
Send("{LCTRL Up}")

can be played through at the same time, but whenever I attempt to play them together with "Sleep" on the right mouse clicks (Auto_scatter), "Until _IsPressed ("21") becomes ineffective, and also, my second script (Auto_Jumper) remains ineffective.

When I leave out the sleep function, "Until _IsPressed ("21") works just fine, but my second script still won't play while the first one is in motion. Basically, they won't go together. What I'm trying to do it have it so that my right mouse repeats, (scatter), while my Ctrl button is being held down (second script) allowing me to still use my left mouse button in person.

It'd be really awesome if someone could help me through this. It's my first actual script, and I'm kind of learning more as it goes.

Edited by Joshuaaaa
Link to comment
Share on other sites

The Sleep is causing the "Until _IsPressed ("21") to be ineffective. Therefore, I cannot use "Page Up" key to stop this script.

Good point.

It looks like you already have a working solution now, but if responsiveness is still an issue change the GUI to GuiOnEventMode vice GuiGetMsg loop, kick the right clicks from AdLibEnable. The AdLibEnable can be dynamically enabled/disabled by your script, or you can turn the action on/off with a flag variable.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...