Jump to content

Keep Right Clicking


 Share

Recommended Posts

Hello all.

Just to let you know I've been searching for about the past 45 minutes to an hour attempting to solve my simple little problem but I have yet to come up with an answer.

What I am attempting to do is have my autoit script resend the right mouse click every xxx ms while the state IsPressed.

Example

I click and hold the right click button on my mouse. I want the script to continue right clicking until I let go of the button and I don't want the script to end.

I want to be able to do this repeatedly until I close the script myself.

I honestly don't know what I am doing and this is what I have thus far.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

_IsPressed("02", $dll)

Do

MouseClick("right")

Sleep(250)

Until _IsPressed("02", $dll) = False

ExitLoop

WEnd

DllClose($dll)

Any help would be greatly appreciated!

Link to comment
Share on other sites

You cannot check the actual state and simulated state of a button at the same time. You have to use another key as your check key.

For Example:

#include <Misc.au3>

While 1
    If _IsPressed("A3") Then
        While _IsPressed("A3")
            MouseClick("right")
            Sleep(250)
        WEnd
    EndIf
    Sleep(10)
WEnd

This right clicks while the right control key is held down.

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

No, the simulated right clicks and actual right clicks cant be distinguished.

You could have it start right clicking when you right click once, and stop when you right click again...

#include <Misc.au3>

While 1
    If _IsPressed("02") Then
        WaitNotPressed()
        While 1
            MouseClick("right")
            If _IsPressed("02") Then
                WaitNotPressed()
                ExitLoop
            EndIf
            Sleep(250)
            If _IsPressed("02") Then
                WaitNotPressed()
                ExitLoop
            EndIf
        WEnd
    EndIf
    Sleep(10)
WEnd

Func WaitNotPressed()
    While _IsPressed("02")
        Sleep(2)
    WEnd
EndFunc

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

I'm not certain on this forums stance on games but it is for a game that I play.

I used to use a very old AutoIT script for this game but I can't seem to find it and neither can google at all lol.

Each right click causes my character to attack monsters which wears away at my mouse with the amnt of clicking done.

Also , I really appreciate your help!

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