diff --git a/#autoclick 2.0 b/#autoclick 2.0 new file mode 100644 index 0000000..2b732ff --- /dev/null +++ b/#autoclick 2.0 @@ -0,0 +1,52 @@ +#autoclick 2.0 + +from pynput.mouse import Button, Controller as MouseController +from pynput.keyboard import Listener, KeyCode +import time + +mouse = MouseController() + +coordinates = [] +click_type = input("Enter click type (left or shift+left): ").strip().lower() + +def on_press(key): + if key == KeyCode(char='x'): + # Record the current mouse position + coordinates.append(mouse.position) + print(f"Coordinate {len(coordinates)} recorded at {mouse.position}") + if len(coordinates) >= max_coordinates: + # Stop listener if max coordinates reached + return False + elif key == KeyCode(char='4'): + # Execute clicks + for pos in coordinates: + mouse.position = pos + if click_type == "left": + mouse.click(Button.left, 1) + elif click_type == "shift+left": + # Hold shift and click + with keyboard.pressed(Key.shift): + mouse.click(Button.left, 1) + time.sleep(1) # Adjust timing as needed + # Ask for repetitions + reps = input("How many times to repeat? (default 1): ") or 1 + try: + reps = int(reps) + except ValueError: + reps = 1 + print(f"Repeating {reps} times") + # Repeat the clicks as per user input + for _ in range(reps): + for pos in coordinates: + mouse.position = pos + if click_type == "left": + mouse.click(Button.left, 1) + elif click_type == "shift+left": + with keyboard.pressed(Key.shift): + mouse.click(Button.left, 1) + time.sleep(1) + +if __name__ == "__main__": + max_coordinates = int(input("How many coordinates? (1-10): ")) + with Listener(on_press=on_press) as listener: + listener.join() diff --git a/#autoclick.py b/#autoclick.py new file mode 100644 index 0000000..aaac95d --- /dev/null +++ b/#autoclick.py @@ -0,0 +1,37 @@ +#autoclick +import os +os.environ['DISPLAY'] = ':0' +import pyautogui +import tkinter as tk +from threading import Thread +from Xlib import display + + +def automate_clicking(): + while True: + pyautogui.click(x1, y1) + pyautogui.click(x2, y2) + +def start_clicking(): + global x1, y1, x2, y2 + x1, y1 = map(int, point1_entry.get().split(',')) + x2, y2 = map(int, point2_entry.get().split(',')) + t = Thread(target=automate_clicking) + t.daemon = True + t.start() + +app = tk.Tk() +app.title("Simple Mouse Clicker") + +tk.Label(app, text="Point 1 (x,y):").pack() +point1_entry = tk.Entry(app) +point1_entry.pack() + +tk.Label(app, text="Point 2 (x,y):").pack() +point2_entry = tk.Entry(app) +point2_entry.pack() + +start_button = tk.Button(app, text="Start Clicking", command=start_clicking) +start_button.pack() + +app.mainloop()