Skip to content

Commit 46975f9

Browse files
committed
Update README, Add Source Code
1 parent f2b163c commit 46975f9

2 files changed

Lines changed: 184 additions & 2 deletions

File tree

README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# PyCrossClicker
2-
A console autoclicker that is made with Python 3.
1+
<!-- MAIN TITLE -->
2+
# • PyCrossClicker
3+
4+
<!-- PICTURE -->
5+
<img align="right" src="http://i.imgur.com/GjG9eSW.png" width=38%>
6+
7+
<!-- BADGES -->
8+
![Python Versions](https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7-blue?style=flat-square)
9+
![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat-square)
10+
11+
<!-- KEY INFORMATION HEADER -->
12+
## → Details / Features
13+
14+
* Fully Functional Autoclicker
15+
* Console Application
16+
* Custom Keyboard Shortcuts
17+
* Customize Clicker Speed
18+
* Simple, Easy, Fast to use
19+
20+
<!-- INSTALLATION HEADER -->
21+
## → Installation Instructions
22+
23+
* You can run the provided exe or binary application for your operating system, or you may install the dependences needed and run this application with python.
24+
25+
```markdown
26+
pip install pynput
27+
<!-- Remember: Only Use this if you only have python 3 installed. -->
28+
29+
or
30+
31+
pip3 instlal pynput
32+
<!-- Remember: Use this if you have two versions of python and / or you have python 2 and python 3. -->
33+
```
34+
35+
Next clone the repo and change directories into the project.
36+
37+
```markdown
38+
git clone https://github.com/TrackRunny/PyCrossClicker.git
39+
40+
cd PyCrossClicker
41+
```
42+
43+
Then run the file!
44+
45+
```markdown
46+
python pycrossclicker.py
47+
<!-- Remember: Only Use this if you only have python 3 installed. -->
48+
49+
or
50+
51+
python3 pycrossclicker.py
52+
<!-- Remember: Use this if you have two versions of python and / or you have python 2 and python 3. -->
53+
```
54+
55+
<!-- LICENSE INFO -->
56+
## → License
57+
58+
* This project is licensed under the GPLv3.

pycrossclicker.py

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import time
2+
import threading
3+
from pynput.mouse import Button, Controller
4+
from pynput.keyboard import Listener, KeyCode
5+
import os
6+
7+
divider = "————————————————————————————————————————————————————————"
8+
9+
try:
10+
clicks = float(input("Delay speed: (Default: 0.060 Seconds ~ 15 Clicks Per Second): "))
11+
delay = clicks
12+
except ValueError:
13+
clicks = 0.060
14+
delay = clicks
15+
16+
print(divider)
17+
18+
# ———————————————————————————————————————————————————————
19+
# ———————————————————————————————————————————————————————
20+
# ———————————————————————————————————————————————————————
21+
22+
input_start_and_stop_key = str(input("Start And Stop Key: (Default: x): "))
23+
start_stop_key = KeyCode(char=input_start_and_stop_key)
24+
25+
if input_start_and_stop_key == "":
26+
start_stop_key = KeyCode(char="x")
27+
28+
print(divider)
29+
30+
# ———————————————————————————————————————————————————————
31+
# ———————————————————————————————————————————————————————
32+
# ———————————————————————————————————————————————————————
33+
34+
input_exit_key = str(input("Exit Key: (Default: `): "))
35+
exit_key = KeyCode(char=input_exit_key)
36+
37+
if input_exit_key == "":
38+
exit_key = KeyCode(char="`")
39+
40+
print(divider)
41+
42+
# ———————————————————————————————————————————————————————
43+
# ———————————————————————————————————————————————————————
44+
# ———————————————————————————————————————————————————————
45+
46+
input_button = str(input("Options: Left, Right, Middle"
47+
"\nMouse button: (Default: Left Mouse Button): "))
48+
input_button = input_button.lower()
49+
button = Button.left
50+
51+
if input_button == "right":
52+
button = Button.right
53+
elif input_button == "middle":
54+
button = Button.middle
55+
else:
56+
pass
57+
58+
print(divider)
59+
60+
# ———————————————————————————————————————————————————————
61+
# ———————————————————————————————————————————————————————
62+
# ———————————————————————————————————————————————————————
63+
64+
65+
class ClickMouse(threading.Thread):
66+
def __init__(self, delay, button):
67+
super(ClickMouse, self).__init__()
68+
self.delay = delay
69+
self.button = button
70+
self.running = False
71+
self.program_running = True
72+
73+
def start_clicking(self):
74+
self.running = True
75+
76+
def stop_clicking(self):
77+
self.running = False
78+
79+
def exit(self):
80+
self.stop_clicking()
81+
self.program_running = False
82+
83+
def run(self):
84+
while self.program_running:
85+
while self.running:
86+
mouse.click(self.button)
87+
time.sleep(self.delay)
88+
time.sleep(0.1)
89+
90+
91+
# ———————————————————————————————————————————————————————
92+
# ———————————————————————————————————————————————————————
93+
# ———————————————————————————————————————————————————————
94+
95+
96+
mouse = Controller()
97+
click_thread = ClickMouse(delay, button)
98+
click_thread.start()
99+
100+
101+
print("Clicker is ready!")
102+
103+
# ———————————————————————————————————————————————————————
104+
# ———————————————————————————————————————————————————————
105+
# ———————————————————————————————————————————————————————
106+
107+
108+
def on_press(key):
109+
if key == start_stop_key:
110+
if click_thread.running:
111+
click_thread.stop_clicking()
112+
os.system("clear")
113+
print("Clicking as stopped!")
114+
print(divider)
115+
else:
116+
click_thread.start_clicking()
117+
os.system("clear")
118+
print("Clicking as started!")
119+
print(divider)
120+
elif key == exit_key:
121+
click_thread.exit()
122+
listener.stop()
123+
124+
125+
with Listener(on_press=on_press) as listener:
126+
listener.join()

0 commit comments

Comments
 (0)