A Python application for creating mouse and keyboard macros, with a focus on rapid clicking functionality.
- Rapid Mouse Clicking: Toggle automatic mouse clicking at the current cursor position
- Mouse Button Triggers: Use mouse side buttons (X1 and X2) to start/stop rapid clicking
- Window-Specific Activation: Optionally target specific application windows for macro execution
- Configurable Delays: Customize the delay between mouse clicks
- Python 3.12 or higher
- Windows operating system (uses Win32 API for window detection)
-
Clone this repository:
git clone https://github.com/falleng0d/mouse-macro.git cd mouse-macro
-
Install dependencies using Poetry:
poetry install
Run the application with default settings:
python main.py
This will start the macro application with default settings.
python main.py [OPTIONS]
Options:
-m, --mouse-delay FLOAT
: Set the delay between mouse clicks (default: 0.05 seconds)-w, --window TEXT
: Target a specific window for input capture (e.g., "chrome")-d, --delay FLOAT
: Set the delay for key presses (for future keyboard macro functionality)
Run with a faster clicking speed (20 clicks per second):
python main.py --mouse-delay 0.05
Run only when a specific application window is active:
python main.py --window "game.exe"
The application uses pynput
to listen for mouse events and pyautogui
to simulate mouse clicks. Then a set of macros, defined in main.py
, will be executed.
The macro toggle_mouse_rapid_press_on_x1_or_x2
for example watches for X1 or X2 mouse button is pressed and then the application toggles a rapid clicking mode that automatically clicks the left mouse button at regular intervals.
If a window name is specified, the macro will only operate when that window is active in the foreground.
main.py
: Entry point and CLI interfacesrc/input/input.py
: Core input service for handling mouse/keyboard eventssrc/input/window.py
: Window detection functionality
To add new macros, create new functions in main.py
that utilize the InputService
.
This project uses:
- Poetry for dependency management
- Ruff for linting
- Pyright for type checking
Contributions are welcome! Please feel free to submit a Pull Request.