A simple yet effective automation tool that allows users to click repeatedly at specific screen coordinates using keyboard shortcuts. Perfect for repetitive clicking tasks in applications, websites, or games.
The Click on Button automation tool is designed to simplify repetitive clicking tasks by allowing users to define specific screen coordinates for automated mouse clicks. When triggered using the Ctrl key, the script moves the mouse to the predefined coordinates, performs a click, and then returns to a different position.
This tool is particularly useful for scenarios requiring repeated clicking at the same position, such as in online forms, games, or applications that don't offer built-in automation options. The entire process is controlled using keyboard shortcuts, making it easy to start and stop the automation as needed.
The tool is implemented in Python using PyAutoGUI for mouse control and the keyboard module for hotkey detection:
import pyautogui
import keyboard
import time
def press_coordinate(x, y):
# Move the mouse to the specified coordinates
pyautogui.moveTo(x, y)
# Click the mouse at the specified coordinates
pyautogui.click()
# Set the coordinates you want to click
x_coordinate = 1740
y_coordinate = 1000
print("Press Ctrl to click the specified coordinates.")
print("Press Esc to exit the script.")
# Function to stop the script when 'Esc' is pressed
def exit_script():
print("Exiting script.")
exit()
# Hook the exit function to 'Esc' key
keyboard.add_hotkey('esc', exit_script)
# Keep running until 'Esc' is pressed
while True:
# Check for 'Ctrl' key press
if keyboard.is_pressed('ctrl'):
press_coordinate(x_coordinate, y_coordinate)
print(f"Clicked at ({x_coordinate}, {y_coordinate})")
# Wait to avoid multiple clicks in rapid succession
time.sleep(0.5)
pyautogui.moveTo(320, 670)
time.sleep(0.5)
The development of this automation tool followed these steps:
The Click on Button automation tool successfully automates repetitive clicking tasks, saving time and reducing fatigue for the user. Its simple implementation makes it accessible even to those with limited programming knowledge, while still being effective for a wide range of applications.
This project demonstrates how even simple automation scripts can significantly improve workflow efficiency and reduce the tedium of repetitive computer tasks. The tool's flexibility makes it adaptable to various scenarios from form filling to game automation.