Skip to content

Commit 0e70aaf

Browse files
committed
Fixed slow clicking bug, new features: 1. Clicking types either single or double, 2. You can set the clicking interval in seconds.
1 parent 49187dc commit 0e70aaf

File tree

3 files changed

+104
-14
lines changed

3 files changed

+104
-14
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Synctic
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# AutoClicker
2-
A simple AutoClicker that has the ability to autoclick and hold the mouse down
2+
3+
A simple AutoClicker that can automatically click the mouse so fast and hold the mouse button down <br />
4+
5+
The new version has a new feature that lets you choose which mouse button to click!
6+
7+
# Features
8+
9+
1. Fast autoclicking
10+
2. Free and Open Source <br />
11+
3. Choose between which mouse button to click as <br />
12+
4. Hold the mouse button down 5. No advertisements
13+
5. Convenient - Hotkey works while application is in background <br />
14+
6. Simple Clean and modern interface

autoclicker.py

+70-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pyautogui
55
import customtkinter
66
import threading
7-
import pydirectinput
87

98
customtkinter.set_appearance_mode("black")
109
customtkinter.set_default_color_theme("blue")
@@ -13,6 +12,7 @@
1312
holdm_key = Key.f6
1413

1514
button1 = "left"
15+
clicktype = "Single"
1616

1717
pause = False
1818

@@ -23,7 +23,7 @@ class App(customtkinter.CTk):
2323
auto1 = False
2424

2525
WIDTH = 300
26-
HEIGHT = 500
26+
HEIGHT = 510
2727

2828
def __init__(self):
2929
super().__init__()
@@ -78,12 +78,37 @@ def __init__(self):
7878
self.buttonmenu_var = customtkinter.StringVar(value="left")
7979

8080
self.buttonmenu = customtkinter.CTkOptionMenu(master=self.frame, text_font=(
81-
"Roboto Medium", -16), width=100, fg_color="black", button_color="black", variable=self.buttonmenu_var, command=self.buttonmenu_event, values=["left", "middle", "right"])
82-
self.buttonmenu.place(x=90, y=370)
81+
"Roboto Medium", -14), width=100, fg_color="black", button_color="black", variable=self.buttonmenu_var, command=self.buttonmenu_event, values=["left", "middle", "right"])
82+
self.buttonmenu.place(x=30, y=370)
8383

8484
self.mousebuttontxt = customtkinter.CTkLabel(
85-
master=self.frame, text="Mouse Button:", text_font=("Roboto Medium", -16))
86-
self.mousebuttontxt.place(x=70, y=340)
85+
master=self.frame, text="Mouse Button:", text_font=("Roboto Medium", -15))
86+
self.mousebuttontxt.place(x=12, y=340)
87+
88+
self.clicktype_var = customtkinter.StringVar(value="Single")
89+
90+
self.clicktypemenu = customtkinter.CTkOptionMenu(master=self.frame, text_font=(
91+
"Roboto Medium", -14), width=100, fg_color="black", button_color="black", variable=self.clicktype_var, command=self.clicktype_event, values=["Single", "Double"])
92+
self.clicktypemenu.place(x=150, y=370)
93+
94+
self.clicktypetxt = customtkinter.CTkLabel(
95+
master=self.frame, text="Click Type:", text_font=("Roboto Medium", -15))
96+
self.clicktypetxt.place(x=130, y=340)
97+
98+
self.clickinterval_var = customtkinter.StringVar(
99+
master=self.frame, value=str(0.01))
100+
101+
self.clickinterval = customtkinter.CTkEntry(master=self.frame, text_font=(
102+
"Roboto Medium", -14), width=80, textvariable=self.clickinterval_var)
103+
self.clickinterval.place(x=100, y=440)
104+
105+
self.clickintervaltxt = customtkinter.CTkLabel(
106+
master=self.frame, text="Click interval", text_font=("Roboto Medium", -14))
107+
self.clickintervaltxt.place(x=70, y=410)
108+
109+
self.secondstxt = customtkinter.CTkLabel(
110+
master=self.frame, text="seconds", text_font=("Roboto Medium", -13), width=10)
111+
self.secondstxt.place(x=185, y=445)
87112

88113
def buttonmenu_event(self, choice):
89114
global button1
@@ -95,6 +120,14 @@ def buttonmenu_event(self, choice):
95120
if choice == "right":
96121
button1 = "right"
97122

123+
def clicktype_event(self, choice):
124+
global clicktype
125+
126+
if choice == "Single":
127+
clicktype = "Single"
128+
if choice == "Double":
129+
clicktype = "Double"
130+
98131
def start_button1(self):
99132
threading.Thread(target=self.autoHold).start()
100133
self.start_hold_button.configure(state="disabled")
@@ -144,33 +177,57 @@ def autoClick(self):
144177
lis = Listener(on_press=self.on_press)
145178
lis.start()
146179

180+
self.interval = float(self.clickinterval.get())
181+
147182
while self.auto1:
148183
if not pause:
149-
if button1 == "left":
150-
pyautogui.leftClick()
151-
if button1 == "middle":
152-
pyautogui.middleClick()
153-
if button1 == "right":
154-
pyautogui.rightClick()
184+
if button1 == "left" and clicktype == "Single":
185+
pyautogui.click(button="left")
186+
pyautogui.PAUSE = self.interval
187+
if button1 == "middle" and clicktype == "Single":
188+
pyautogui.click(button="middle")
189+
pyautogui.PAUSE = self.interval
190+
if button1 == "right" and clicktype == "Single":
191+
pyautogui.click(button="right")
192+
pyautogui.PAUSE = self.interval
193+
194+
if button1 == "left" and clicktype == "Double":
195+
pyautogui.doubleClick(button="left")
196+
pyautogui.PAUSE = self.interval
197+
if button1 == "middle" and clicktype == "Double":
198+
pyautogui.doubleClick(button="middle")
199+
pyautogui.PAUSE = self.interval
200+
if button1 == "right" and clicktype == "Double":
201+
pyautogui.doubleClick(button="right")
202+
pyautogui.PAUSE = self.interval
155203
if pause:
156204
break
157205
lis.stop()
158206

159207
def stop_button1(self):
160208
pause = True
161209
self.auto = False
210+
162211
if button1 == "left":
163212
pyautogui.mouseUp(button="left")
164213
if button1 == "middle":
165214
pyautogui.mouseUp(button="middle")
166215
if button1 == "right":
167216
pyautogui.mouseUp(button="right")
217+
168218
self.start_hold_button.configure(state="enabled")
169219

170220
def stop_button2(self):
171221
pause = True
172222
self.auto1 = False
173-
pyautogui.mouseUp()
223+
224+
if button1 == "left" and clicktype == "Single":
225+
pyautogui.mouseUp(button="left")
226+
if button1 == "middle" and clicktype == "Single":
227+
pyautogui.mouseUp(button="middle")
228+
if button1 == "right" and clicktype == "Single":
229+
pyautogui.mouseUp(button="right")
230+
174231
self.start_auto_button.configure(state="enabled")
175232

176233
def on_close(self, event=0):

0 commit comments

Comments
 (0)