Posted 2 years ago
·
Author
Below are some Autoit scripts I wrote to automate clicking in games and other applications.
Script #1
The first script is a basic auto clicker, it will run continuously until told to stop.
Script #2
This second script is a slightly more advanced version of the first. It requires holding down a key in order to run. By default the key is
Customization
To change which mouse button the scripts use, edit this line:
To change which key must be pressed for the second script, edit this line:
How do I use these scripts?
To learn how to use these scripts, see my tutorial on compiling AutoIT scripts here: viewtopic.php?f=113&t=12150
References
Key Code List: https://www.autoitscript.com/autoit3/do ... ressed.htm
Mouse Button List https://www.autoitscript.com/autoit3/do ... eClick.htm
Script #1
The first script is a basic auto clicker, it will run continuously until told to stop.
#include <misc.au3>
#include <AutoItConstants.au3>
HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Stop")
HotKeySet("{ESC}", "Terminate")
Global $bStop = False
Global $bDisplayTrayTip = True
;~ The mouse button to click with
;~ See https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm for a list of mouse buttons
Global $sMouseButton = $MOUSE_CLICK_LEFT
While 1
Sleep(100)
Wend
Func Start()
$bStop = False
While Not $bStop
If $bDisplayTrayTip Then
TrayTip("Auto Clicker", "Enabled", 0)
$bDisplayTrayTip = False
EndIf
MouseClick($sMouseButton)
WEnd
EndFunc
Func Stop()
$bStop = True
TrayTip("Auto Clicker", "Disabled", 0)
$bDisplayTrayTip = True
EndFunc
Func Terminate()
Exit 0
EndFunc
Script #2
This second script is a slightly more advanced version of the first. It requires holding down a key in order to run. By default the key is
CTRL
. This script is meant for scenarios where you need finer control over when the script clicks such as crafting in a video game.#include <misc.au3>
#include <AutoItConstants.au3>
HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Stop")
HotKeySet("{ESC}", "Terminate")
Global $bStop = False
Global $bDisplayTrayTip = True
;~ The key code for the key that must be pressed to activate the auto clicker
;~ See https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm for a list of key codes
Global $iActivationKey = 11
;~ The mouse button to click with
;~ See https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm for a list of mouse buttons
Global $sMouseButton = $MOUSE_CLICK_LEFT
While 1
Sleep(100)
Wend
Func Start()
$bStop = False
While Not $bStop
If _IsPressed($iActivationKey) Then
If $bDisplayTrayTip Then
TrayTip("Auto Clicker", "Enabled", 0)
$bDisplayTrayTip = False
EndIf
MouseClick($sMouseButton)
EndIf
WEnd
EndFunc
Func Stop()
$bStop = True
TrayTip("Auto Clicker", "Disabled", 0)
$bDisplayTrayTip = True
EndFunc
Func Terminate()
Exit 0
EndFunc
Customization
To change which mouse button the scripts use, edit this line:
To change which key must be pressed for the second script, edit this line:
How do I use these scripts?
To learn how to use these scripts, see my tutorial on compiling AutoIT scripts here: viewtopic.php?f=113&t=12150
References
Key Code List: https://www.autoitscript.com/autoit3/do ... ressed.htm
Mouse Button List https://www.autoitscript.com/autoit3/do ... eClick.htm