Skip to main content

Precise mouse and keyboard action recorder and replayer

Project description

🖱️ BrogCursor

Precise Mouse & Keyboard Action Recorder for Python

PyPI version Python versions

Record, replay, and automate user interactions with pixel-perfect precision

InstallationQuick StartExamplesDocumentationLicense


BrogsCursor gives you high-fidelity recording and replay of every mouse movement, click, and keystroke. Perfect for UI automation, testing, and creating flawless demonstrations.

from brogscursor import record

recorder = record()
recorder.start_recording()  # Press Esc to stop recording
recorder.replay(recorder.stop_recording())

Table of Contents

Installation

Install the latest stable version from PyPI:

pip install brogscursor

When using this package in your application, it's recommended to pin to at least the major version:

pip install brogscursor==0.1.*

Get Started

Record and replay user actions in just 4 lines of code:

from brogscursor import record

recorder = record()
recorder.start_recording()  # Press Esc to stop recording
recorder.replay(recorder.stop_recording())

Features

Feature Description
Precise Recording Capture mouse movements, clicks, scrolls, and keyboard events with high precision
Exact Timing Replay actions with the same timing as the original recording
Customizable Adjust playback speed, loop count, and more
Control Pause/resume recording, stop replay with a hotkey
Resolution Aware Automatically scales recorded actions to the current screen resolution
Rich CLI Beautiful terminal interface with the Rich library
Multi-format Export Save recordings as JSON, CSV, or human-readable text
Robust API Comprehensive Python API for integration into your projects

Creating Your First Recording

from brogscursor import record
from brogscursor.recorder import BrogsCursorRecorder

def main():
    # Create a recorder instance
    recorder = record()
    
    print("Starting recording - press Esc to stop")
    
    # Start recording (this will block until Escape is pressed)
    recorder.start_recording()
    
    # Save the recording
    recording_file = recorder.stop_recording()
    print(f"Recording saved to: {recording_file}")
    
    # Replay the recording
    print("Replaying recorded actions...")
    recorder.replay(recording_file)

if __name__ == "__main__":
    main()

Using the Command-Line Interface

BrogsCursor provides an interactive CLI for easy recording and playback:

# Launch the interactive CLI
brogscursor

Keyboard Controls

  • Esc: Stop recording
  • p: Pause/resume recording
  • Ctrl+C: Exit CLI

CLI Features

  • Start recording with optional timeout
  • List and manage saved recordings
  • Replay recordings with various settings
  • Customize configuration

Customizing Settings

from brogscursor import record

# Create a recorder with custom settings
recorder = record(
    log_dir="my_recordings",   # Custom directory to save recordings
    max_events=10000,          # Maximum number of events to record
    record_keyboard=True,      # Record keyboard events
    speed_multiplier=1.5       # Default replay speed
)

# Start recording with a 30-second timeout
recorder.start_recording(timeout=30)

Supported Platforms

BrogsCursor works across multiple platforms:

  • Windows: Full support for mouse and keyboard recording/replay
  • macOS: Full support (requires Accessibility permissions)
  • Linux: Full support on X11 systems

Examples

Minimal Example

import brogscursor

# One-liner recording and replay
brogscursor.record().start_recording().replay(brogscursor.record().stop_recording())

Quick Record Example

from brogscursor import record

# Create recorder
recorder = record()

# Start recording
recorder.start_recording()

# Stop and save recording
recording_file = recorder.stop_recording()

# Replay saved recording
recorder.replay(recording_file)

Custom Settings Example

from brogscursor import record

# Custom recorder configuration
recorder = record(
    log_dir="./custom_recordings",
    max_events=20000,
    record_keyboard=True,
    speed_multiplier=1.5
)

# Start recording with 15-second timeout
recorder.start_recording(timeout=15)

# Replay with custom options
recorder.replay(
    recorder.stop_recording(),
    precision_mode=True,
    loop_count=2
)

Save to File Example

from brogscursor import record
from brogscursor.utils import export_recording
import os

# Record actions
recorder = record()
recorder.start_recording()
recording_path = recorder.stop_recording()

# Export to different formats
exports_dir = "exports"
if not os.path.exists(exports_dir):
    os.makedirs(exports_dir)

# Export as CSV
csv_path = export_recording(recording_path, "csv", os.path.join(exports_dir, "actions.csv"))
print(f"Exported to CSV: {csv_path}")

# Export as human-readable text
txt_path = export_recording(recording_path, "txt", os.path.join(exports_dir, "actions.txt"))
print(f"Exported to text: {txt_path}")

Multiple Recordings Example

from brogscursor import record
from brogscursor.utils import merge_recordings

# Create recorder
recorder = record()

# Record first sequence
print("Recording first sequence - press Esc when done")
recorder.start_recording()
first_recording = recorder.stop_recording()

# Record second sequence
print("Recording second sequence - press Esc when done")
recorder.start_recording()
second_recording = recorder.stop_recording()

# Merge recordings
merged_recording = merge_recordings([first_recording, second_recording], "merged_actions.json")
print(f"Merged recording saved to: {merged_recording}")

# Play merged recording
recorder.replay(merged_recording)

Available Methods

from brogscursor import record
from brogscursor.utils import get_recording_info, export_recording, merge_recordings

# Core recorder methods
recorder = record()
recorder.start_recording(timeout=None)  # Start recording with optional timeout
recorder.stop_recording()               # Stop and save recording
recorder.pause_recording()              # Pause current recording
recorder.resume_recording()             # Resume paused recording
recorder.list_recordings()              # List all saved recordings
recorder.replay(                        # Replay a recording with options
    "recording.json",
    precision_mode=True,
    filter_events=None,
    loop_count=1,
    stop_key='p'
)

# Utility functions
info = get_recording_info("recording.json")  # Get recording metadata
export_recording("recording.json", "csv")    # Export to different format
merge_recordings(["rec1.json", "rec2.json"]) # Combine multiple recordings

Documentation

For complete documentation, see the following resources:

  • Examples: The examples/ directory contains fully-commented example scripts.
  • API Documentation: See the API Reference section above.
  • Command-Line Help: Run brogscursor --help for CLI documentation.
  • Source Code: The source code includes detailed docstrings.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brogcursor-0.1.2.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brogcursor-0.1.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file brogcursor-0.1.2.tar.gz.

File metadata

  • Download URL: brogcursor-0.1.2.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for brogcursor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8f482d7f2ceeb59a743143f98c0d2124bb3a9164cae2eaa7e186f58df8c7c7ee
MD5 ad35c7dece6e02855985cb571de00732
BLAKE2b-256 8da88f195adb4e8d00ccaf2c86fa88892acc6797fbf8bb32ed64b23a99e4dfff

See more details on using hashes here.

File details

Details for the file brogcursor-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: brogcursor-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for brogcursor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f356c58fbf334e63f61f595c384f682be5928e63f77532f04bede3ce33a4cb8
MD5 315d8f3bd3304c5d8b3aada93ef3942c
BLAKE2b-256 f26aea444aa22de4400df10c744a4e0b5b110759c278aa2fe3dd446de5c4894a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page