Jump to content

MouseClick is pausing my function


Recommended Posts

Hello , im etryyng to create a Autoclicker when i hold right / left button it will be clicking

Left click it will click once and pause the Do

Right click isnt even working

 

Code :

#include <Misc.au3>
;Variables
Global $LeftClickHold = False
Global $RightClickHold = False
Global $LclickCount = 0
Global $RclickCount = 0
Local $hDLL = DllOpen("user32.dll")
Global $Num = 0
Global $MaxNum = 1000


Do
    If _IsPressed(01, $HDLL) Then
        $LeftClickHold = True
        $LclickCount += 1
        ToolTip($LclickCount)
        Send("LC")
    Else
        $LeftClickHold = False
        $LclickCount = 0
    EndIf
        Sleep(10)
Until $Num >= $MaxNum

Do
    If _IsPressed(02, $HDLL) Then
        $RightClickHold = True
        $RclickCount += 1
        ToolTip($RclickCount)
        Send("RC")
    Else
        $RightClickHold = False
        $RclickCount = 0
    EndIf
        Sleep(10)
Until $Num >= $MaxNum

Link to post
Share on other sites
#include <Misc.au3>
;Variables
Global $LeftClickHold = False
Global $RightClickHold = False
Global $LclickCount = 0
Global $RclickCount = 0
Local $hDLL = DllOpen("user32.dll")
Global $Num = 0
Global $MaxNum = 1000


Do
    If _IsPressed(01, $HDLL) Then
        $LeftClickHold = True
        $LclickCount += 1
        ToolTip($LclickCount)
        Send("LC")
    Else
        $LeftClickHold = False
        $LclickCount = 0
    EndIf
        Sleep(10)
Until $Num >= $MaxNum

Do
    If _IsPressed(02, $HDLL) Then
        $RightClickHold = True
        $RclickCount += 1
        ToolTip($RclickCount)
        Send("RC")
    Else
        $RightClickHold = False
        $RclickCount = 0
    EndIf
        Sleep(10)
Until $Num >= $MaxNum

 

Link to post
Share on other sites
  • Developers

You have 2 loops in there of which the second will never be performed.
Having said that, I can only assume this is for game automation so would urge you to read our forum rules  now first before continuing posting in these forums.

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 post
Share on other sites
#include <Misc.au3>

Global $LeftClickHold = False
Global $RightClickHold = False
Local $hDLL = DllOpen("user32.dll")
Global $MaxNum = 1000

While 1
    If _IsPressed(01, $HDLL) Then
        $LeftClickHold = True
        $LclickCount = 0
        While _IsPressed(01, $HDLL) And $LclickCount < $MaxNum
            $LclickCount += 1
            ToolTip($LclickCount)
            Send("LC")
            Sleep(10)
        WEnd
        $LeftClickHold = False
    EndIf

    If _IsPressed(02, $HDLL) Then
        $RightClickHold = True
        $RclickCount = 0
        While _IsPressed(02, $HDLL) And $RclickCount < $MaxNum
            $RclickCount += 1
            ToolTip($RclickCount)
            Send("RC")
            Sleep(10)
        WEnd
        $RightClickHold = False
    EndIf
    
    Sleep(10)
WEnd

 

Edited by Zedna
Link to post
Share on other sites

The Send(LC) and Send(RC)   was just for debugging it when i will try to add MouseClick("left") and MoueClick("right") instead of the Sends like its working but have same problem with the original script it will just pause at 1 and it wont click while im holding mouseclick, the limit was to do the repeat bc i didnt knew any way to make it loop

#include <Misc.au3>

Global $LeftClickHold = False
Global $RightClickHold = False
Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed(01, $HDLL) Then
        $LeftClickHold = True
        $LclickCount = 0
        While _IsPressed(01, $HDLL)
            $LclickCount += 1
            ToolTip($LclickCount)
            MouseClick("left")
            Sleep(10)
        WEnd
        $LeftClickHold = False
    EndIf

    If _IsPressed(02, $HDLL) Then
        $RightClickHold = True
        $RclickCount = 0
        While _IsPressed(02, $HDLL)
            $RclickCount += 1
            ToolTip($RclickCount)
            MouseClick("right")
            Sleep(10)
        WEnd
        $RightClickHold = False
    EndIf

    Sleep(10)
WEnd

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...