Automate Thinkorswim (ToS) Desktop actions — a small utility to automate the "Scan" button in the Thinkorswim desktop app using image-based GUI automation.
This repository contains a lightweight Python script (tos_scan_button.py) and a reference image (scan_button.png) used to locate and click the Scan button in the Thinkorswim application. It is primarily tested on macOS; Windows/Linux may work but could need adjustments (screen scaling, image replacement, permission settings).
- Image-based detection of the Scan button (uses the included
scan_button.png). - Simple, single-file script to run from the repository root.
- Minimal dependencies — listed in
requirements.txt.
- Python 3.8+
- See
requirements.txtfor Python package dependencies (e.g.,pyautogui,opencv-python, etc.).
- Create and activate a virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txtRun the script from the repository root:
python3 tos_scan_button.pyNotes:
- Make sure the Thinkorswim desktop app is open and the Scan button is visible on screen when you run the script.
- If your display uses scaling (HiDPI / Retina), the included
scan_button.pngmay not match — see Troubleshooting below.
On macOS you must grant the running Python process permission to control your computer and capture the screen. Open:
- System Settings → Privacy & Security → Accessibility → add your terminal or Python runtime
- System Settings → Privacy & Security → Screen Recording → add your terminal or Python runtime
After granting permissions, restart the terminal (or the Python process) and try again.
- "Button not found": the screenshot (
scan_button.png) may not match your UI scale or theme. Take a new screenshot of the Scan button and replacescan_button.png. - Different display resolution / scaling: try running with the display set to 100% scaling or capture a fresh reference image.
- Permission errors on macOS: ensure Accessibility and Screen Recording permissions are granted as noted above.
- The script is intentionally small. If you add features, include tests and update
requirements.txtas needed.
Contributions are welcome. Open an issue or a pull request with a short description of the change.
This project includes a LICENSE file in the repository root — see that file for the license terms.