This Python script finds and clicks on-screen blobs matching a sequence of colors you define, one color at a time, waiting for you to press ENTER to advance to the next color.
- Sequential color workflow – Clicks blobs for Color #1, pauses, then waits for you to press
ENTERbefore moving on to Color #2, and so on. - Exact color picking – Click directly on the screen to sample each color.
- Fast, human-like clicking – Random delay between clicks (0.045–0.08s).
- Quit anytime – Press
ESCor move cursor to the top left corner of your screen (failsafe)
- Python 3.8+
- Libraries:
pip install mss opencv-python numpy pyautogui pynput keyboard
- Run the script as administrator:
python place.py
- Enter the number of colors you want to track.
- For each color:
- When prompted, click directly on the screen to sample that color.
- The script starts paused at the first color.
- Press
ENTERto click all blobs matching the current color (≥ 2×2 px, 4-connectivity). - After finishing that color, the script auto-pauses and advances to the next color.
- Repeat until all colors are processed.
- Quit at any time with
ESCorCtrl+C.
- Tolerance: Fixed at
15. Adjust in code (tol = 15) if you need looser/tighter matching. - Connectivity: Uses 4-connectivity (diagonals are not connected).
- Blob filter: Ignores blobs smaller than
2×2pixels. - Global hotkeys:
- Requires the
keyboardlibrary and running the script as Administrator on Windows forENTER/ESCto work outside the Python window.pip install keyboard
- Without it,
ENTER/ESConly work when the console or the preview window has focus.
- Requires the
- Preview: The mask preview window (if present in your version) shows matched pixels in white and background in black for verification.