This project is a Python-based desktop automation bot that fetches blog posts from the JSONPlaceholder API and automatically writes each post into separate text files using Windows Notepad.
The bot uses computer vision, screenshot analysis, mouse/keyboard automation, and fallback strategies to reliably locate the Notepad icon anywhere on the desktop, even when using busy wallpapers or dark/light themes.
- Detects the Notepad icon anywhere on the desktop
- Dynamically calculates the exact screen coordinates of the icon
- Works with:
- Busy or textured wallpapers
- Dark mode and light mode
- Fully automated typing and saving
- Multiple fallback strategies for reliability
- Fetches blog posts from JSONPlaceholder API
- Automatically launches Windows Notepad
- Desktop icon detection using OpenCV
- Multi-scale template matching
- Screenshot-based analysis
- Fallback launch via Win + R
- Types formatted blog content:
- Title
- Body
- Saves each post as an individual
.txtfile - Automatically handles file overwrite confirmations
- Saves annotated screenshots for debugging
- Processes a configurable number of posts (default: first 10)
- Operating System: Windows 10 / Windows 11
- Screen Resolution: 1920 × 1080
- Desktop Capabilities:
- Screenshot capture
- Mouse & keyboard control
- Image processing
- Captures a full desktop screenshot
- Converts image to grayscale
- Applies edge detection (Canny)
- Performs multi-scale template matching
- Detects the icon even if:
- Desktop background is busy
- Dark or light theme is used
- Calculates the icon’s center coordinates
- Moves the mouse and double-clicks to open Notepad
- Saves annotated screenshots for verification
The bot includes strong error handling for the following cases:
- Icon not found on desktop
- Multiple matching icons detected
- Icon partially obscured by windows
- Desktop background affects detection
- Retry logic:
- Up to 3 attempts
- 1-second delay between retries
- Validates that Notepad actually launched by:
- Window title verification
- Timeout-based checks
- Fallback to Win + R → notepad.exe if icon detection fails
- Graceful degradation if API is unavailable
- Browser-based fallback to fetch JSON data
- Clipboard-based data extraction as backup
- Detects existing files in the target directory
- Automatically confirms file replacement dialogs
- Verifies that files are saved successfully
- Python 3.7+
- Windows OS
- Active desktop session
- Recommended: Virtual environment
git clone <repository-url>
cd <project-folder>python -m venv venv
.\venv\Scripts\Activate.ps1pip install .