apple-js

Control macOS like magic ✨

with apple-js

Fluent, async macOS automation via AppleScript. No AppleScript knowledge needed. Just pure JavaScript magic for desktop automation.

v1.0.4
1.2k stars
📦npm install apple-js-stable

See it in action

Watch the magic happen in real-time

Terminal
$ node apple-js-demo.js
|

Powerful Features

Everything you need for macOS automation

Speak Text

Make your Mac talk with natural speech synthesis using different voices.

Display Alerts

Show native macOS alerts and notifications with custom sounds.

Open Chrome

Launch Chrome and navigate to URLs with full browser control.

Take Screenshots

Capture screenshots and save them to your desktop automatically.

Play System Sounds

Play classic Mac sounds like Sosumi and custom system audio.

Tell Jokes

Let Siri tell jokes and entertain users with AI-powered humor.

Type Text

Simulate keyboard input and type text into any application.

Fullscreen Apps

Control window management and make apps fullscreen.

Why apple-js?

Built for developers, by developers

Fluent API

Intuitive, chainable methods that read like natural language.

Async/Await

Modern JavaScript patterns with full Promise support.

Zero AppleScript Knowledge

No need to learn AppleScript. Just use familiar JavaScript.

Fun & Powerful

From simple alerts to complex automation workflows.

Quick Start

Get up and running in minutes

1. Install

bash
npm install apple-js-stable

2. Use

javascript
const { Osascript } = require("apple-js-stable");
const script = new Osascript();

async function startTest() {
    await script.executeScript([
        script.appleCommands.display("Welcome to apple.js, Glad to see you, shall we open chrome?"),
        script.appleCommands.speak("Welcome to apple js, shall we open chrome?"),
    ]);
    await script.executeSingleCommand(script.appleCommands.systemControl.screenshotToDesktop());
    await script.executeSingleCommand(script.appleCommands.fun.playSosumi()); 
    await script.executeScript([
        script.appleCommands.notifications.alertWithSound("Opsii Dubsii","Looks like Siri wants to tell joke.","Blow"),
        script.appleCommands.delay(3),
        script.appleCommands.ai.tellJoke(),
        script.appleCommands.notifications.alertWithSound("Apple-js version 1.0.4","Enjoy the new methods of apple-js","Glass"),
        script.appleCommands.delay(3),
        script.appleCommands.fun.dramaticAnnouncement("Holy Moly ! i am alive "),
        script.appleCommands.demoTypeHelloWorld(),
        script.appleCommands.speak("Are you impressed with apple js ?","Zarvox"),
        script.appleCommands.ui.typeText("Apple-js",0.5),
        script.appleCommands.notifications.alertWithSound("Apple-js version 1.0.4","Enjoy the latest version")
    ]);
}
startTest();