Skip to content

falleng0d/mouse-macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mouse Macro

A Python application for creating mouse and keyboard macros, with a focus on rapid clicking functionality.

Features

  • 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

Requirements

  • Python 3.12 or higher
  • Windows operating system (uses Win32 API for window detection)

Installation

  1. Clone this repository:

    git clone https://github.com/falleng0d/mouse-macro.git
    cd mouse-macro
    
  2. Install dependencies using Poetry:

    poetry install
    

Usage

Basic Usage

Run the application with default settings:

python main.py

This will start the macro application with default settings.

Command Line Options

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)

Examples

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"

How It Works

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.

Development

Project Structure

  • main.py: Entry point and CLI interface
  • src/input/input.py: Core input service for handling mouse/keyboard events
  • src/input/window.py: Window detection functionality

Adding New Macros

To add new macros, create new functions in main.py that utilize the InputService.

Development Tools

This project uses:

  • Poetry for dependency management
  • Ruff for linting
  • Pyright for type checking

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Mouse Macro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages