-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
AutoClicker.py
1396 lines (1081 loc) · 55.1 KB
/
AutoClicker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import pyautogui
import time
import tkinter as tk
import webbrowser
from tkinter import *
from tkinter import messagebox
import keyboard
from tkinter import ttk
from tkinter import filedialog
import os
import sys
import datetime
import threading
import time
try:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
except:
pass
try:
import win10toast #This module only works on windows
except:
pass
try:
from PIL import ImageGrab
from colormap import rgb2hex
from win32api import GetSystemMetrics
except:
pass
################################################################################
# /\ | | | |__ __/ __ \ / ____| | |_ _/ ____| |/ / ____| __ \ #
# / \ | | | | | | | | | | | | | | | || | | ' /| |__ | |__) |#
# / /\ \| | | | | | | | | | | | | | | || | | < | __| | _ / #
# / ____ \ |__| | | | | |__| | | |____| |____ _| || |____| . \| |____| | \ \ #
# /_/ \_\____/ |_| \____/ \_____|______|_____\_____|_|\_\______|_| \_\#
################################################################################
def Colour_Clicker():
master = Tk()
master.title("Colour Clicker")
master.geometry("+300+300")
master.attributes("-topmost", True)
master.resizable(False, False)
try:
window.iconbitmap('favicon.ico')
except:
pass
color = 1
xStart = 0
xEnd = 111
yStart = 0
yEnd = 111
def return_entry():
color = entry.get()
xStart1 = entry2.get()
xStart = int(xStart1,10)
xEnd1 = entry3.get()
xEnd = int(xEnd1,10)
yStart1 = entry4.get()
yStart = int(yStart1,10)
yEnd1 = entry5.get()
yEnd = int(yEnd1,10)
mainscript()
# Create this method before you create the entry
ttk.Label(master, text="Enter color in hexadecimals:").grid(row=0, sticky=W)
ttk.Label(master, text="Enter start cordinate in x axis:").grid(row=1, sticky=W)
ttk.Label(master, text="Enter stop cordinate in x axis:").grid(row=2, sticky=W)
ttk.Label(master, text="Enter start cordinate in y axis:").grid(row=3, sticky=W)
ttk.Label(master, text="Enter end cordinate in y axis:").grid(row=4, sticky=W)
ttk.Button(master, text="start", command= return_entry).grid(row=5, sticky=W)
entry = ttk.Entry(master)
entry.grid(row=0, column=1)
entry2 = ttk.Entry(master)
entry2.grid(row=1, column=1)
entry3 = ttk.Entry(master)
entry3.grid(row=2, column=1)
entry4 = ttk.Entry(master)
entry4.grid(row=3, column=1)
entry5 = ttk.Entry(master)
entry5.grid(row=4, column=1)
# Connect the entry with the return button
entry.bind('<Return>', return_entry)
entry2.bind('<Return>', return_entry)
entry3.bind('<Return>', return_entry)
entry4.bind('<Return>', return_entry)
def mainscript():
# returns the color of given pixel
def get_pixel_colour(i_x, i_y):
import win32gui
i_desktop_window_id = win32gui.GetDesktopWindow()
i_desktop_window_dc = win32gui.GetWindowDC(i_desktop_window_id)
long_colour = win32gui.GetPixel(i_desktop_window_dc, i_x, i_y)
i_colour = int(long_colour)
print(long_colour)
return rgb2hex((i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff))
# get the size of screen
width = GetSystemMetrics(0)
height = GetSystemMetrics(1)
stepSize = 10
# scanning the screen for given color
selectedCordinates = []
for w in range(xStart, xEnd, 10):
for h in range(yStart, yEnd, 10):
print("Now scanning pixel at", (w, h))
if(get_pixel_colour(w, h)==(color)):
selectedCordinates.append([w, h])
pyautogui.FAILSAFE = False
# start click events
for cordinate in selectedCordinates:
print("i got here")
pyautogui.click(x=cordinate[2], y=cordinate[1])
def Locate_Click():
window = Tk()
label1 = tk.Label(window, text='Locate and click', font=('helvetica', 14)).pack()
def click_image():
locate = pyautogui.locateCenterOnScreen(window.filename)
pyautogui.click(locate)
def select_image():
window.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("jpeg files","*.jpg"),("all files","*.*")))
button_select = ttk.Button(window, text="Select Image",command=select_image)
button_Find = ttk.Button(window, text="Find and click on image",command=click_image)
button_select.pack()
button_Find.pack()
try:
window.iconbitmap('favicon.ico')
except:
pass
window.attributes("-topmost", True)
window.resizable(False, False)
window.title("Locate and Click")
window.geometry("+300+300")
window.geometry("200x100")
window.mainloop()
def feedback():
root= tk.Tk()
root.geometry("+300+300")
root.attributes("-topmost", True)
root.title('Send Feedback') # Set title
scope = ["https://spreadsheets.google.com/feeds", 'https://www.googleapis.com/auth/spreadsheets',
"https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"]
creds = creds = ServiceAccountCredentials.from_json_keyfile_name("creds.json", scope)
client = gspread.authorize(creds)
sheet = client.open("feedback").sheet1
label1 = tk.Label(root, text='Send Feedback', font=('helvetica', 14)).grid(row=1, column=3)
try:
root.iconbitmap('favicon.ico')
except:
pass
root.resizable(False, False)
entry1 = ttk.Entry(root)
entry1.grid(row=3, column=3)
def sendfeedbackbutton():
try:
x1 = entry1.get()
sheet.update('A1', x1)
messagebox.showinfo('Sent', 'Feedback was sent!!')
except:
messagebox.showerror('Fail', 'Feedback failed to send')
pass
label2 = tk.Label(root, text='Type your Feedback:',font=('helvetica', 10)).grid(row=2, column=3)
button1 = ttk.Button(root, text='Send', command=sendfeedbackbutton).grid(row=4, column=3)
root.mainloop()
def NOTIFICATION():
try:
toaster = win10toast.ToastNotifier()
toaster.show_toast("AutoClicker", "V6.0", duration=5, threaded=True, icon_path ="favicon.ico")
messagebox.showinfo('AutoClicker', 'V6.0')
except:
messagebox.showinfo('AutoClicker', 'V6.0')
pass
def tutorial():
try:
os.startfile("AutoClickerHelpPage.exe")
except:
window = Tk()
window.title("Tutorial")
window.geometry('770x50')
tab_control = ttk.Notebook(window)
tab1 = ttk.Frame(tab_control)
tab2 = ttk.Frame(tab_control)
tab_control.add(tab1, text='First Step')
tab_control.add(tab2, text='Second Step')
lbl1 = Label(tab1, anchor=W,
text='First get the coordinates, click on Find Coordinates the first number is the x coordinate and the second is the y coordinate.')
lbl1.grid(column=0, row=0)
lbl2 = Label(tab2,
text='Input the X and Y coordinates into the X and Y entry boxes set a key as the stop key and press start you can use the stop key to stop the clicking.')
lbl2.grid(column=0, row=0)
tab_control.pack(expand=1, fill='both')
try:
window.iconbitmap('favicon.ico')
except:
pass
window.attributes("-topmost", True)
window.resizable(False, False)
window.geometry("+300+300")
window.mainloop()
def OldStyleGUI():
class YourGUI(tk.Tk):
def __init__(self):
# inherit tkinter's window methods
tk.Tk.__init__(self)
tk.Label(self, text="ENTER Y:", background="#e7dff2").grid(row=0, column=2)
self.inputX = tk.Entry(self)
self.inputX.grid(row=0, column=1)
tk.Label(self, text="ENTER X:", background="#e7dff2").grid(row=0, column=0)
self.inputY = tk.Entry(self)
self.inputY.grid(row=0, column=3)
self.cmb = ttk.Combobox(self, width="10", values=("Left Click","Right Click","Middle Click","Double Right Click","Double Left Click","Double Middle Click"))
ttk.Label(self, text="Delay Between clicks", background="#e7dff2", anchor=E).grid(row=5, column=0)
self.inputdelayentry = tk.StringVar()
self.inputdelayentry.set("0")
self.inputdelay = tk.Entry(self, textvariable= self.inputdelayentry).grid(row=5, column=1)
class TableDropDown(ttk.Combobox):
def __init__(self, parent):
self.current_table = tk.StringVar() # create variable for table
ttk.Combobox.__init__(self, parent)# init widget
self.config(textvariable = self.current_table, state = "readonly", values = ["Customers", "Pets", "Invoices", "Prices"])
self.current(0) # index of values for current table
self.place(x = 50, y = 50, anchor = "w") # place drop down box
ttk.Label(self, text="""Choose the left or
right mouse button""", background="#e7dff2", anchor=E).grid(row=1, column=0)
self.cmb.grid(row=1, column=1, sticky="ew")
self.cmb.current(0)
# Start Button ⬇
tk.Button(self, text="start", fg='green', command=self.startclick).grid(row=6, column=0)
# close button ⬇
tk.Button(self, text="exit!", fg='red', command=self.EXITME).grid(row=7, column=0)
self.inputhotkey = tk.Entry(self)
self.inputhotkey.grid(row=1, column=3, columnspan=1)
def callback():
webbrowser.open_new(r"https://kai9987kai.github.io/AutoClicker.html")
def callback2():
webbrowser.open_new(r"https://github.com/kai9987kai/AutoClicker")
tk.Button(self, text="ABOUT", command=callback).grid(row=5, column=3, sticky="ew")
def clicked3():
your_gui.destroy()
pyautogui.PAUSE = 0.50
pyautogui.FAILSAFE = True
things = []
root = Tk()
root.geometry("550x425")
list_box = Listbox(root, font=(12))
list_box.config(width=30, height=18)
list_box.place(x=0, y=0)
run_btn = Button(root, text="Run List", command=lambda: run_list(), font=(12))
run_btn.place(x=350, y=15)
run_btn.config(width=15)
del_btn = Button(root, text="Delete", command=lambda: delete(list_box), font=(12))
del_btn.place(x=350, y=105)
del_btn.config(width=15)
add_btn = Button(root, text="Add", command=lambda: add(), font=(12))
add_btn.place(x=350, y=60)
add_btn.config(width=15)
x_txt = StringVar()
y_txt = StringVar()
x_label = Label(root, text="x", font=(12))
x_label.place(x=350, y=150)
x = Entry(root, textvariable=x_txt)
x.place(x=375, y=150)
x_txt.set('')
y_label = Label(root, text="y", font=(12))
y_label.place(x=350, y=180)
y = Entry(root, textvariable=y_txt)
y.place(x=375, y=180)
y_txt.set('')
cmb = ttk.Combobox(root, width="15", values=("Left Click","Right Click","Middle Click","Double Right Click","Double Left Click","Double Middle Click"))
ttk.Label(root, text="""Select whether to right or
left click the list""", anchor=E).place(x=350, y=220)
cmb.place(x=350, y=265)
cmb.current(0)
def add():
content_x = x_txt.get()
content_y = y_txt.get()
closed_str = [content_x, content_y]
things.append(closed_str)
list_box.delete(0, 'end')
for i in range(len(things)):
list_box.insert(END, things[i])
def run_list():
x_cords = [item[0] for item in things]
y_cords = [item[1] for item in things]
for i in range(len(things)):
if cmb.get() == "Left Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click()
elif cmb.get() == "Right Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(button='right')
pyautogui.click()
elif cmb.get() == "Middle Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(button='middle')
pyautogui.click()
elif cmb.get() == "Double Right Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='right')
pyautogui.click()
elif cmb.get() == "Double Left Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='left')
pyautogui.click()
elif cmb.get() == "Double Middle Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='middle')
pyautogui.click()
def delete(listbox):
global things
# Delete from Listbox
selection = list_box.curselection()
list_box.delete(selection[0])
# Delete from list that provided it
value = eval(list_box.get(selection[0]))
ind = things.index(value)
del (things[ind])
popup = Menu(root, tearoff=0)
popup.add_command(label='Run list', command=run_list)
popup.add_command(label='Exit', command=self.EXITME)
def do_popup(event):
# display the popup menu
try:
popup.tk_popup(event.x_root, event.y_root, 0)
finally:
# make sure to release the grab (Tk 8.0a1 only)
popup.grab_release()
root.bind("<Button-3>", do_popup)
root.title("AutoClicker - list of coordinates")
try:
root.iconbitmap('favicon.ico')
except:
pass
root.resizable(False, False)
root.attributes("-topmost", True)
root.mainloop()
def Finder():
try:
os.startfile("AutoClickerMouseCoordinatesPage.exe")
except:
messagebox.showerror("ERROR", "AutoClickerMouseCoordinatesPage.exe is missing")
pass
tk.Button(self, text="List Coordinates", command=clicked3).grid(row=7, column=3,sticky="ew")
tk.Button(self, text="Find Coordinates", command=Finder).grid(row=6, column=3, sticky="ew")
def clicked():
os.startfile("AutoClickerContactPage.exe")
def settings():
window = Tk()
window.title("Settings")
window.geometry('335x130')
try:
window.iconbitmap('favicon.ico')
except:
pass
window.resizable(False, False)
window.geometry("+0+0")
window.attributes("-topmost", True)
def callBackFunc():
your_gui.overrideredirect(True)
window.destroy()
def ExitWindow():
window.destroy()
def Full_screen():
your_gui.attributes('-fullscreen', True)
your_gui.bind('<Escape>', lambda e: root.destroy())
window.destroy()
def Exit_Full_Screen():
python = sys.executable
os.execl(python, python, * sys.argv)
def Show_Title_bar():
python = sys.executable
os.execl(python, python, * sys.argv)
ttk.Label(window, text="Settings").grid(column=0, row=1, sticky="ew")
Button(window, text=" Exit Settings ", command=ExitWindow).grid(column=0, row= 6)
Button(window, text="FullScreen", command=Full_screen).grid(column=0, row=3, sticky="ew")
Button(window, text="Exit FullScreen", command=Exit_Full_Screen).grid(column=1, row=3, sticky="ew")
Button(window, text="Hide Title Bar ", command=callBackFunc).grid(column=0, row=5, sticky="ew")
Button(window, text="Show Title Bar", command=Show_Title_bar).grid(column=1, row=5, sticky="ew")
Button(window, text="Restart program", command=Show_Title_bar).grid(column=1, row=6, sticky="ew")
popup = Menu(your_gui, tearoff=0)
popup.add_command(label="FullScreen", command=Full_screen)
popup.add_command(label="Exit FullScreen", command=Exit_Full_Screen)
popup.add_command(label="Hide Title Bar", command=callBackFunc)
popup.add_command(label="Show Title Bar", command=Show_Title_bar)
popup.add_command(label="Restart program", command=Show_Title_bar)
popup.add_command(label="Exit Settings", command=ExitWindow)
def do_popup(event):
try:
popup.tk_popup(event.x_root, event.y_root, 0)
finally:
popup.grab_release()
window.bind("<Button-3>", do_popup)
window.mainloop()
def OpenModernWindow():
your_gui.destroy()
MAINWINDOW_NEWSTYLE()
def clicked2():
try:
os.startfile("AutoClickerMegaSpam.exe")
except:
messagebox.showerror("Error", "AutoClickerMegaSpam.exe is missing")
pass
# Menu Bar!! ⬇
menu = Menu(self)
new_item = Menu(menu)
new_item.add_command(label='About', command=callback)
new_item.add_command(label='Github Page', command=callback2)
new_item.add_command(label='List Coordinates', command=clicked3)
new_item.add_command(label='Version Number', command=NOTIFICATION)
new_item.add_command(label='Modern Style', command=OpenModernWindow)
new_item.add_command(label='Auto Clicker Mega Spam', command=clicked2)
new_item.add_command(label='Coordinates Finder', command=Finder)
new_item.add_command(label='Send Feedback', command=feedback)
new_item.add_command(label='Locate and Click', command=Locate_Click)
new_item.add_command(label='Colour/Color Clicker', command=Colour_Clicker)
new_item.add_command(label='Settings', command=settings)
new_item.add_separator()
new_item.add_command(label='Start', command=self.do_conversion)
new_item.add_command(label='Exit', command=self.EXITME)
menu.add_cascade(label='Menu', menu=new_item)
new_item2 = Menu(menu)
new_item2.add_command(label='Tutorial', command=tutorial)
new_item2.add_command(label='Contact', command=clicked)
menu.add_cascade(label='Help', menu=new_item2)
popup = Menu(self, tearoff=0)
popup.add_command(label="About", command=callback)
popup.add_command(label="Send Feedback", command=feedback)
popup.add_command(label='GitHub Page', command=callback2)
popup.add_command(label='Auto Clicker Mega Spam', command=clicked2)
popup.add_command(label='Version Number', command=NOTIFICATION)
popup.add_command(label='Modern Style', command=OpenModernWindow)
popup.add_command(label='Settings', command=settings)
popup.add_command(label='List of coordinates', command=clicked3)
popup.add_command(label='Locate and Click', command=Locate_Click)
popup.add_command(label='Colour/Color Clicker', command=Colour_Clicker)
popup.add_command(label='Find Coordinates', command=Finder)
popup.add_separator()
popup.add_command(label='Start', command=self.do_conversion)
popup.add_command(label='Exit', command=self.EXITME)
def do_popup(event):
# display the popup menu
try:
popup.tk_popup(event.x_root, event.y_root, 0)
finally:
# make sure to release the grab (Tk 8.0a1 only)
popup.grab_release()
self.bind("<Button-3>", do_popup)
self.config(menu=menu)
tk.Label(self, text="Keyboard key to stop clicking:", background="#e7dff2").grid(row=1, column=2)
def EXITME(self):
YourGUI.destroy(self)
def startclick(self):
x1 = threading.Thread(target=self.do_conversion, daemon=True)
x1.start()
def do_conversion(self):
if self.cmb.get() == "Left Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
# strtoint("crashmE!")
while running:
pyautogui.FAILSAFE = False # disables the fail-safe
pyautogui.click(x, y)
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
if keyboard.is_pressed(self.inputhotkey.get()):
break
elif self.cmb.get() == "Right Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
# strtoint("crashmE!")
while running:
pyautogui.FAILSAFE = False # disables the fail-safe
pyautogui.click(button='right')
pyautogui.click(x, y)
if keyboard.is_pressed(self.inputhotkey.get()):
break
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
elif self.cmb.get() == "Middle Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
while running:
pyautogui.FAILSAFE = False
pyautogui.click(button='middle')
pyautogui.click(x, y)
time.sleep(int(self.inputdelayentry.get()))
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
if keyboard.is_pressed(self.inputhotkey.get()):
break
elif self.cmb.get() == "Double Right Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
while running:
pyautogui.FAILSAFE = False
pyautogui.click(clicks=2)
pyautogui.click(button='right')
pyautogui.click(x, y)
time.sleep(int(self.inputdelayentry.get()))
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
if keyboard.is_pressed(self.inputhotkey.get()):
break
elif self.cmb.get() == "Double Left Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
while running:
pyautogui.FAILSAFE = False
pyautogui.click(clicks=2)
pyautogui.click(button='left')
pyautogui.click(x, y)
time.sleep(int(self.inputdelayentry.get()))
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
if keyboard.is_pressed(self.inputhotkey.get()):
break
elif self.cmb.get() == "Double Middle Click":
y = self.inputY.get()
x = self.inputX.get()
running = True
try:
x = int(x)
y = int(y)
except:
messagebox.showerror('Invalid point', 'Invalid point')
YourGUI.destroy(self)
while running:
pyautogui.FAILSAFE = False
pyautogui.click(clicks=2)
pyautogui.click(button='middle')
pyautogui.click(x, y)
time.sleep(int(self.inputdelayentry.get()))
num= int(self.inputdelayentry.get())
start_time = datetime.datetime.now()
while (datetime.datetime.now() - start_time).total_seconds() < num:
if keyboard.is_pressed(self.inputhotkey.get()):
exit(0)
else:
pass
if keyboard.is_pressed(self.inputhotkey.get()):
break
def do_hotkey(self):
hotkey = self.inputhotkey.get()
if __name__ == '__main__':
your_gui = YourGUI()
your_gui.geometry("+300+300")
your_gui.attributes("-topmost", True)
your_gui.title('AutoClicker') # Set title
try:
your_gui.iconbitmap('favicon.ico')
except:
pass
your_gui.resizable(False, False)
your_gui.configure(background="#e7dff2")
your_gui.mainloop()
class Coordinates():
replayBtn = (100, 350)
def MAINWINDOW_NEWSTYLE():
class YourGUI(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
ttk.Label(self, text="ENTER Y:", background="#e7dff2", anchor=E).grid(row=0, column=2)
ttk.Label(self, text="Delay Between clicks", background="#e7dff2", anchor=E).grid(row=5, column=0)
self.inputdelayentry = tk.StringVar()
self.inputdelayentry.set("0")
self.inputdelay = ttk.Entry(self, textvariable= self.inputdelayentry).grid(row=5, column=1)
self.inputX = ttk.Entry(self)
self.inputX.grid(row=0, column=1)
self.cmb = ttk.Combobox(self, width="15", values=("Left Click","Right Click","Middle Click","Double Right Click","Double Left Click","Double Middle Click"))
class TableDropDown(ttk.Combobox):
def __init__(self, parent):
self.current_table = tk.StringVar() # create variable for table
ttk.Combobox.__init__(self, parent)# init widget
self.config(textvariable = self.current_table, state = "readonly", values = ["Customers", "Pets", "Invoices", "Prices"])
self.current(0) # index of values for current table
self.place(x = 50, y = 50, anchor = "w") # place drop down box
ttk.Label(self, text="""Choose the left or
right mouse button""", background="#e7dff2", anchor=E).grid(row=1, column=0)
self.cmb.grid(row=1, column=1, sticky="ew")
self.cmb.current(0)
ttk.Label(self, text="ENTER X:", background="#e7dff2").grid(row=0, column=0)
self.inputY = ttk.Entry(self)
self.inputY.grid(row=0, column=3)
# Start Button ⬇
ttk.Button(self, text="start", command=self.startclick).grid(row=6, column=0)
# close button ⬇
ttk.Button(self, text="exit!", command=self.EXITME).grid(row=7, column=0)
self.inputhotkey = ttk.Entry(self)
self.inputhotkey.grid(row=1, column=3, columnspan=1)
def callback():
webbrowser.open_new(r"https://kai9987kai.github.io/AutoClicker.html")
def callback2():
webbrowser.open_new(r"https://github.com/kai9987kai/AutoClicker")
ttk.Button(self, text="ABOUT", command=callback).grid(row=5, column=3, sticky="ew")
def clicked3():
your_gui.destroy()
pyautogui.PAUSE = 0.50
pyautogui.FAILSAFE = True
things = []
root = Tk()
root.geometry("600x400")
list_box = Listbox(root, font=(12))
list_box.config(width=30, height=18)
list_box.place(x=0, y=0)
run_btn = ttk.Button(root, text="Run List", command=lambda: run_list())
run_btn.place(x=350, y=20)
run_btn.config(width=15)
del_btn = ttk.Button(root, text="Delete", command=lambda: delete(list_box))
del_btn.place(x=350, y=80)
del_btn.config(width=15)
add_btn = ttk.Button(root, text="Add", command=lambda: add())
add_btn.place(x=350, y=50)
add_btn.config(width=15)
x_txt = StringVar()
y_txt = StringVar()
x_label = Label(root, text="x", font=(12))
x_label.place(x=350, y=150)
x = ttk.Entry(root, textvariable=x_txt)
x.place(x=375, y=150)
x_txt.set('')
y_label = Label(root, text="y", font=(12))
y_label.place(x=350, y=170)
y = ttk.Entry(root, textvariable=y_txt)
y.place(x=375, y=180)
y_txt.set('')
cmb = ttk.Combobox(root, width="15", values=("Left Click","Right Click","Middle Click","Double Right Click","Double Left Click","Double Middle Click"))
ttk.Label(root, text="""Select whether to right or
left click the list""", anchor=E).place(x=350, y=250)
cmb.place(x=350, y=300)
cmb.current(0)
root.title("AutoClicker - list of coordinates")
try:
root.iconbitmap('favicon.ico')
except:
pass
root.resizable(False, False)
root.attributes("-topmost", True)
def add():
content_x = x_txt.get()
content_y = y_txt.get()
closed_str = [content_x, content_y]
things.append(closed_str)
list_box.delete(0, 'end')
for i in range(len(things)):
list_box.insert(END, things[i])
def run_list():
x_cords = [item[0] for item in things]
y_cords = [item[1] for item in things]
for i in range(len(things)):
if cmb.get() == "Left Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click()
elif cmb.get() == "Right Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(button='right')
pyautogui.click()
elif cmb.get() == "Middle Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(button='middle')
pyautogui.click()
elif cmb.get() == "Double Right Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='right')
pyautogui.click()
elif cmb.get() == "Double Left Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='left')
pyautogui.click()
elif cmb.get() == "Double Middle Click":
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.moveTo(int(x_cords[i]), int(y_cords[i]))
# print("Gonna Click",x_cords[i],y_cords[i])
pyautogui.click(clicks=2)
pyautogui.click(button='middle')