Desktop Automation

Automate any desktop application

Control mouse, keyboard, and screen programmatically with Node.js. Works with any application on Windows, macOS, and Linux—no source code access required.

invoice-processor.ts
import {
    mouse, Button, keyboard, Key, straightTo, centerOf, getActiveWindow
} from "@nut-tree/nut-js";
import {useElementInspector} from "@nut-tree/element-inspector";
import { elements } from "@nut-tree/element-inspector/win";
import { readFileSync } from "fs";

useElementInspector();

// Read data from CSV file
const records = readFileSync("invoices.csv", "utf-8")
    .split("\n").slice(1);

const window = await getActiveWindow();

for (const record of records) {
    const [customer, amount, date] = record.split(",");

    // Click "New Invoice" button
    const newBtn = await window.find(
        elements.button({ title: "New Invoice" })
    );
    await mouse.move(straightTo(centerOf(newBtn.region)));
    await mouse.click(Button.LEFT);

    // Fill form fields by their labels
    const customerField = await window.find(
        elements.textInput({ label: "Customer" })
    );
    await mouse.move(straightTo(centerOf(customerField.region)));
    await mouse.click(Button.LEFT);
    await keyboard.type(customer);

    // Save with keyboard shortcut
    await keyboard.pressKey(Key.LeftControl, Key.S);
}

Why choose nut.js for automation?

Built for developers who need reliable, maintainable desktop automation.

Cross-Platform

Write once, run on Windows, macOS, and Linux. Same API, same behavior.

Smart Element Search

Find elements by image, text, color, or UI structure. Multiple search strategies for any scenario.

Precise Control

Pixel-perfect mouse movements with configurable speed and easing functions.

Zero Setup

Prebuilt binaries for all platforms. No compilers, no build tools, just npm install.

Built for real-world automation

From simple repetitive tasks to complex multi-application workflows, nut.js handles it all with a clean, intuitive API.

Data Entry Automation

Automate repetitive data entry tasks across multiple applications. Import from Excel, enter into legacy systems, validate results.

Report Generation

Automatically generate reports by navigating through applications, extracting data, and compiling results.

System Administration

Automate system configuration, software installation, and maintenance tasks across your infrastructure.

Legacy System Integration

Bridge the gap between modern systems and legacy applications that lack APIs.

workflow.ts
import {
    mouse, Button, keyboard, Key, screen, straightTo, centerOf,
    imageResource, sleep
} from "@nut-tree/nut-js";

async function automateDataEntry(records: string[]) {
    for (const record of records) {
        // Click the "New Entry" button
        const newEntry = await screen.waitFor(
            imageResource("new-entry.png")
        );
        await mouse.move(straightTo(centerOf(newEntry)));
        await mouse.click(Button.LEFT);

        // Enter the data
        await keyboard.type(record);
        await keyboard.pressKey(Key.Tab);

        // Save and continue
        await keyboard.pressKey(Key.Enter);
        await sleep(500);
    }
}

Ready to automate your desktop?

Get started in minutes. No complex setup, no build tools—just install and start automating.