Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 71ea0a0

Browse files
Merge pull request #41 from Sacrezar/main
PR - Add Autoclicker
2 parents 55e002b + b22447a commit 71ea0a0

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

‎autoclicker/README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# AutoClicker
2+
This is a basic autoclicker, you can choose the delay you want between each click.
3+
## Prerequisites
4+
5+
**Python 3.8.x**
6+
7+
Install the requirements:
8+
9+
`python -m pip install -r requirements.txt --user`
10+
11+
Then you can run the script!
12+
13+
## Controls
14+
Key | Action
15+
--- | ---
16+
F1 | Resume / Pause
17+
ESC | Exit the program

‎autoclicker/autoclicker.py‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import pyautogui
2+
from pynput.keyboard import Key, Listener
3+
4+
# ======== Controls ========
5+
start_or_pause_key = Key.f1
6+
exit_key = Key.esc
7+
delay = 1 # seconds
8+
9+
# ==== global variables ====
10+
pause = True
11+
running = True
12+
13+
14+
def display_controls():
15+
16+
print("F1 = Start / Pause")
17+
print("ESC = Exit\n")
18+
19+
20+
def choose_delay():
21+
22+
try:
23+
return float(input("Enter wanted delay (seconds): "))
24+
except ValueError:
25+
print(f"You did not give a valid input, default delay : {delay}sec")
26+
return delay
27+
28+
29+
def key_press(key):
30+
global running, pause
31+
32+
if key == start_or_pause_key:
33+
pause = not pause
34+
print("< Pause >") if pause else print("< Start >")
35+
elif key == exit_key:
36+
running = False
37+
print("< Exit >")
38+
39+
40+
def main():
41+
42+
delay = choose_delay()
43+
print(f"delay = {str(delay)}sec\n")
44+
display_controls()
45+
46+
listener = Listener(on_press=key_press)
47+
listener.start()
48+
49+
while running:
50+
if not pause:
51+
pyautogui.click(pyautogui.position())
52+
pyautogui.PAUSE = delay
53+
listener.stop()
54+
55+
56+
if __name__ == "__main__":
57+
main()

‎autoclicker/requirements.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pyautogui
2+
pynput

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /