๐ฏ A development toolkit for AutoJS6 script developers, with visual screenshot analysis, UI widget parsing, image matching preview, and AutoJS6 script code generation.
Choose the edition that fits your platform strategy
autojs6-dev-toolsis the Windows-native edition, optimized for a performance-first Windows experience.
For the Cross-platform edition, seeautojs6-dev-tools-plus.
Both projects are original works that I design and maintain as part of the same AutoJS6 toolkit family.
Image recognition takes 20 tries to work? Breaks on different devices?
Use this tool: Real-time match preview โข Visual threshold and region adjustment โข Auto-generate AutoJS6 code
Bring screenshot analysis, widget inspection, and AutoJS6 code generation into one native Windows workbench. Tune match regions visually, validate selectors against the current UI tree, and export runnable code without bouncing between crop tools, terminals, and repeated device-side trial and error.
Live template cropping ยท Threshold tuning ยท Widget boundary inspection ยท AutoJS6-ready code generation
Developing AutoJS6 scripts without this tool:
- ๐ธ Screenshot โ Manually crop template โ Save โ Write code โ Run on device
- ๐ Guess coordinates (x: 500? 520? 540?) โ Write code โ Run on device
- โ Template not found โ Adjust crop by 2 pixels โ Run again
- ๐ Repeat 20 times until it works
- ๐ฑ Test on another device โ Different resolution โ Start over
- ๐ค Threshold 0.8 or 0.85? โ Try one by one on real device
- ๐ฒ Need resource-id? โ Manually search through 5000 UI nodes
- ๐ฅ Click missed by 10 pixels โ Recalculate offset โ Run again
Hours wasted. Every. Single. Day.
See template matching results BEFORE running on device:
- Drag to crop template โ Instantly see match confidence (0.95? 0.62?)
- Adjust threshold slider โ Watch matches appear/disappear in real-time
- Wrong crop? Adjust 2 pixels โ See result immediately
- No more "run โ fail โ adjust โ run" loops
Pick coordinates with mouse, not guesswork:
- Hover over screenshot โ See exact pixel coordinates (x: 523, y: 187)
- Click to mark โ Coordinates copied to clipboard
- Drag rectangle โ Get region [x, y, w, h] automatically
- No more "let me try x+10... no wait, x+15..."
Generate AutoJS6 code automatically:
- Select template โ Click "Generate Code" โ Get complete script
- Image mode:
images.findImage()with correct threshold and region - Widget mode:
id().text().findOne()with fallback selectors - Copy-paste ready, no manual typing
Test on multiple resolutions without real devices:
- Load screenshots from 3 devices โ Test template on all
- See which resolution fails โ Adjust crop once โ Works everywhere
- No more "works on my phone but not on user's phone"
You need this if you:
- โ Spend >30 minutes per day cropping screenshots and adjusting coordinates
- โ Test scripts on multiple Android devices with different resolutions
- โ Use image recognition features frequently
- โ Need to manually search UI tree for widget attributes
- โ Want to preview matching results without running on device
You DON'T need this if:
- โ You only use simple fixed-coordinate clicks
- โ You never use image matching or widget selectors
- โ You enjoy manually debugging 20 times per feature
- ๐ป OS: Windows 10/11 (Build 22621.0+)
- โ๏ธ Runtime: .NET 8 SDK
- ๐ ๏ธ IDE: Visual Studio 2022/2026 with WinUI 3 workload
- ๐ฑ Tools: Android Debug Bridge (ADB) in PATH
git clone https://github.com/yourusername/autojs6-dev-tools.git
cd autojs6-dev-tools# Restore NuGet packages
dotnet restoreEdit AGENTS.md to set your local paths:
YXS_DAY_TASK_ROOT="C:\path\to\your\yxs-day-task"
AUTOJS6_DOCS_ROOT="C:\path\to\AutoJs6-Documentation"
AUTOJS6_SOURCE_ROOT="C:\path\to\AutoJs6"# Restore solution packages
dotnet restore autojs6-dev-tools.slnx
# Build solution
dotnet build autojs6-dev-tools.slnx
# Run application
dotnet run --project App/App.csprojOr open autojs6-dev-tools.slnx in Visual Studio and press F5.
- ๐ธ Real-Time Screenshot Capture: Pull device screenshots via ADB with one click
- โ๏ธ Interactive Cropping: Drag vertices/edges to adjust, Shift to lock aspect ratio
- ๐ฏ Pixel Coordinate Picker: Mouse hover shows exact coordinates, Ctrl for crosshair lock
- ๐ OpenCV Template Matching: TM_CCOEFF_NORMED algorithm with adjustable threshold (0.50-0.95)
- ๐พ Template Export: Save cropped regions as PNG with offset metadata
- ๐ฑ Android UI Tree Parsing: Pull and parse uiautomator dump data
- ๐งน Smart Layout Filtering: Automatically remove 70%+ redundant layout containers
- ๐จ Widget Boundary Rendering: Color-coded by type (Blue=Text, Green=Button, Orange=Image)
- ๐ Bidirectional Sync: Click TreeView โ highlight canvas, click canvas โ expand TreeView
- ๐ Property Panel: One-click copy coordinates, text, or XPath expressions
- โก 60 FPS Rendering: Win2D GPU-accelerated dual-layer architecture
- ๐ Zoom & Pan: Mouse wheel zoom (10%-500%, cursor-centered), drag to pan with inertia
- ๐ Rotation Support: 90ยฐ step rotation with coordinate system preservation
- ๐ Auxiliary Tools: Pixel ruler, 10x10 grid, crosshair lock
Image Mode (Pixel-based matching)
// Auto-generated AutoJS6 code
requestScreenCapture();
var template = images.read("./assets/login_button.png");
var result = images.findImage(screen, template, {
threshold: 0.85,
region: [100, 200, 300, 400]
});
if (result) {
click(result.x + 150, result.y + 25);
log("Clicked login button");
}
template.recycle();Widget Mode (Selector-based)
// Auto-generated AutoJS6 code
var widget = id("com.example:id/login_button").findOne();
if (!widget) widget = text("Login").findOne();
if (!widget) widget = desc("Login Button").findOne();
if (widget) {
widget.click();
log("Clicked login button");
}- ๐๏ธ Live Threshold Adjustment: Slider (0.50-0.95) with instant visual feedback
- โ UiSelector Validation: Test selectors against current UI tree
- ๐ Coordinate Alignment Check: Verify widget bounds match screenshot pixels
- ๐ Batch Testing: Load multiple templates, generate summary report
autojs6-dev-tools/
โโโ App/ # WinUI 3 desktop application
โ โโโ Views/ # Pages and custom controls
โ โโโ ViewModels/ # MVVM view models
โ โโโ Services/ # App-layer orchestration services
โ โโโ Models/ # UI-facing models
โ โโโ Resources/ # Styles and resource dictionaries
โ โโโ CodeTemplates/ # AutoJS6 code generation templates
โ โโโ App.csproj
โโโ Core/ # Pure business logic (no UI dependencies)
โ โโโ Abstractions/ # Service interfaces
โ โโโ Models/ # Domain models
โ โโโ Services/ # Core business services
โ โโโ Helpers/ # Utility classes
โ โโโ Core.csproj
โโโ Infrastructure/ # External dependency adapters
โ โโโ Adb/ # ADB communication
โ โโโ Imaging/ # OpenCV / imaging wrappers
โ โโโ Infrastructure.csproj
โโโ App.Tests/ # UI/app-level tests
โโโ Core.Tests/ # Core unit tests
โโโ docs/
โ โโโ images/ # README screenshots and demo assets
โโโ openspec/ # OpenSpec change proposals
โโโ AGENTS.md # Core design principles (AI agent context)
โโโ autojs6-dev-tools.slnx # Solution entry
โโโ README.md # This file
- ๐ผ๏ธ Image Engine: Pixel/bitmap โ absolute pixel coordinates (x, y, w, h)
- ๐ฒ UI Engine: Widget tree โ UiSelector chains (id().text().findOne())
- ๐ซ Zero Coupling: Data sources, processing pipelines, rendering logic, and code generation paths are completely decoupled
App โ Infrastructure โ Core โ Infrastructure
- ๐ฏ Core: Pure business logic, no UI dependencies, independently testable
- ๐ Infrastructure: External dependency wrappers (SharpAdbClient, OpenCvSharp4)
- ๐จ App: UI and MVVM only
- All I/O operations (ADB, OpenCV, XML parsing, texture upload) use
async/await - UI thread never blocked
- Background operations with
CancellationTokensupport
| Component | Technology | Purpose |
|---|---|---|
| ๐จ UI Framework | WinUI 3 + Windows App SDK 1.5+ | Native Windows desktop UI |
| ๐ผ๏ธ Rendering | Microsoft.Graphics.Win2D | 60 FPS GPU-accelerated canvas |
| ๐ Image Processing | OpenCvSharp4.Windows + SixLabors.ImageSharp | Template matching and image manipulation |
| ๐ฑ ADB Communication | SharpAdbClient | Android device control |
| ๐ MVVM | CommunityToolkit.Mvvm | View model binding and commands |
| ๐๏ธ Architecture | Clean Architecture | Layered separation of concerns |
- Read
AGENTS.mdfor core design principles - Read
openspec/project.mdfor development checklist - Analyze existing cmd scripts in
$YXS_DAY_TASK_ROOT - Review AutoJS6 documentation and source code
- โ Maintain dual-engine independence
- โ Follow unidirectional dependency rules
- โ Use async/await for all I/O operations
- โ Keep modules under 512 lines
- โ Write tests for Core layer
- โ Verify project layer dependencies (App โ Infrastructure โ Core)
- โ Verify dual-engine isolation
- โ Verify async architecture
- โ Verify 60 FPS rendering performance
- โ Run unit tests
Generated code must comply with AutoJS6 runtime constraints:
// โ WRONG: const/let in loop body (Rhino bug - variable won't rebind)
while (true) {
const result = computeSomething();
process(result); // result keeps first iteration value!
}
// โ
CORRECT: Use var in loop body
while (true) {
var result = computeSomething();
process(result); // result correctly updates each iteration
}- ๐ธ Single screenshot per iteration: Never call
captureScreen()multiple times in one loop - ๐ฏ Minimize scene detection scope: Don't scan all templates every iteration
- ๐ Prefer region-based matching: Use
region: [x, y, w, h]instead of full-screen - โป๏ธ Recycle ImageWrapper objects: Call
.recycle()immediately after use
โ
Include: Text, icons, fixed borders
โ Exclude: Red dots, numbers, countdowns, dynamic values
We welcome contributions! Please:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐ Read
AGENTS.mdandopenspec/project.mdthoroughly - ๐๏ธ Follow the architecture principles
- โ Write tests for Core layer changes
- ๐ฌ Commit with clear messages (
git commit -m 'add amazing feature') - ๐ Push to your branch (
git push origin feature/amazing-feature) - ๐ Open a Pull Request
This toolkit is designed to serve AutoJS6 automation projects, particularly:
- ๐ฎ yxs-day-task: Hero Kill daily task automation (primary beneficiary)
- ๐ AGENTS.md: Core design principles and constraints (read first)
- ๐ openspec/project.md: Development checklist and verification rules
- ๐ openspec/changes/: OpenSpec change proposals
This project is licensed under the MIT License - see the LICENSE.txt file for details.
- AutoJS6 - Android automation framework
- WinUI 3 - Modern Windows UI framework
- Win2D - GPU-accelerated 2D graphics
- OpenCvSharp - OpenCV wrapper for .NET
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
If this tool saves you hours of tedious work, consider buying me a coffee! Your support keeps this project alive and helps me dedicate more time to adding new features.
Support via:
|
WeChat Pay ![]() Scan to donate |
Alipay ![]() Scan to donate |
็ฑๅ็ต (afdian) Monthly sponsorship |
Your support enables:
- โก Continuous development and maintenance
- ๐ฏ New features based on community feedback
- ๐ Professional documentation and video tutorials
- ๐ ๏ธ Long-term stability and updates
Sponsors get:
- ๐ Name listed in project credits
- ๐ฌ Direct communication channel
- ๐ Early access to new features
Every contribution matters. Thank you! ๐
Thanks to the following sponsors for their generous support:
Built with โค๏ธ for AutoJS6 developers




