Skip to content

aidankamdar/OnePress

Repository files navigation

One Press - Universal Problem Solver

A hotkey-activated automation tool that instantly solves problems from any webpage using AI. One press extracts the problem, gets the solution, and copies it to your clipboard.

Features

  • ⌨️ One Keypress: Press the hotkey on any webpage to get an instant solution
  • 🌐 Universal: Works on any website - coding platforms, LMS, homework pages, and more
  • 🤖 AI-Powered: Uses OpenAI GPT-4o for accurate solutions (code, math, science, etc.)
  • 📋 Instant Clipboard: Solutions automatically copied and ready to paste
  • 🎯 Auto-Detection: Intelligently finds problem content on any page layout
  • 🔄 Background Service: Runs continuously, ready whenever you need it

How It Works

  1. Launch Chrome with debugging enabled (one-time setup)
  2. Start the script (runs in background)
  3. Browse to any webpage containing a problem
  4. Press 'P' to extract the problem and get a solution
  5. Press Ctrl+V to paste the solution

Installation

1. Install Python Dependencies

pip install -r requirements.txt

Note: The keyboard library requires administrator privileges on Windows.

2. Ensure Chrome is Installed

The script connects to your existing Chrome browser (no special setup needed).

Configuration (Optional)

The script works out-of-the-box, but you can customize settings in onepress.py:

Change the Hotkey

HOTKEY = "p"  # Change to any key: "f9", "ctrl+shift+s", etc.

Change AI Model

OPENAI_MODEL = "gpt-4o"        # Most capable (default)
OPENAI_MODEL = "gpt-4o-mini"   # Faster, cheaper

Usage

Step 1: Launch Chrome with Debugging

Double-click launch_chrome.bat (Windows)

This opens Chrome with remote debugging enabled. Browse normally in this window.

For Mac/Linux users: Create a similar script or run:

# Mac
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir="$HOME/Library/Application Support/Google/Chrome"

# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.config/google-chrome"

Step 2: Start One Press

Open a terminal/PowerShell and run:

python onepress.py

Important: Run as administrator on Windows (right-click PowerShell → "Run as administrator")

You should see:

✨ Ready! Press 'P' on any webpage to solve the problem

Step 3: Use It!

  1. Navigate to any webpage with a problem
  2. Press 'P' on your keyboard
  3. Wait a few seconds while the solution is generated
  4. The solution is automatically copied to your clipboard
  5. Press Ctrl+V to paste it wherever you need

Troubleshooting

❌ "Error connecting to Chrome"

Problem: Script can't connect to Chrome

Solutions:

  • Make sure you launched Chrome using the launcher script (not the normal Chrome icon)
  • Check that Chrome is still running
  • Verify no firewall is blocking port 9222
  • Try closing all Chrome windows and re-running the launcher

❌ "Failed to extract problem"

Problem: Script can't find the problem text on the page

Solutions:

  • Make sure the page has loaded fully before pressing the hotkey
  • Check that the page contains visible text content
  • Try refreshing the page and pressing the hotkey again

❌ "requires administrator privileges" (Windows)

Problem: Keyboard library needs admin rights

Solution:

  • Close PowerShell/CMD
  • Right-click PowerShell → "Run as administrator"
  • Navigate to the One Press folder
  • Run: python onepress.py

❌ "API key file not found"

Problem: Can't find apikey.txt

Solution:

  • Ensure apikey.txt is in the same folder as the script
  • Check that the file contains your OpenAI API key
  • No extra spaces or newlines in the file

⚠️ Hotkey Not Working

Problem: Pressing the hotkey doesn't do anything

Solutions:

  • Make sure the Python script is running (check the terminal)
  • Verify you ran the script as administrator on Windows
  • Try changing the hotkey to something else (like "f9") in the config
  • Check if another program is intercepting the key

Tips & Best Practices

  1. Keep Chrome Window Open: Don't close the Chrome window launched by the script
  2. Run Script Once: The script runs continuously - no need to restart for each problem
  3. Wait for Completion: Give it a few seconds to process before trying again
  4. Check Terminal: Watch the terminal for status messages and errors

Security & Privacy

  • ✅ Your API key is stored locally and never shared
  • ✅ The script only reads the current page when you press the hotkey
  • ✅ No data is stored or logged
  • ⚠️ Keep apikey.txt secure and never commit it to version control (it's in .gitignore)

Disclaimer

This tool is for productivity and educational purposes. Use responsibly and in compliance with applicable policies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors