jxa-lib-examples

jxa-lib examples.

View on GitHub

jxa-lib-examples

GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot pages-build-deployment Stargazers pre-commit Prettier TypeScript Yarn eslint vitest

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

A small collection of JavaScript for Automation (JXA) example scripts that demonstrate the jxa-lib helper library on macOS. The bundled binary presents a Finder chooser, then runs the selected example through osascript.

Examples

Each entry below corresponds to a module under src/:

Requirements

macOS 10.10 Yosemite or newer. The examples drive AppleScript-scriptable applications and call into Cocoa through the Objective-C bridge.

Installation

Download the prebuilt bundle from master:

curl -fLO https://raw.githubusercontent.com/Tatsh/jxa-lib-examples/refs/heads/master/dist/index.js

The file already carries a JXA shebang (#!/usr/bin/env osascript -l JavaScript), so making it executable is enough to run it on its own:

chmod +x index.js

Usage

Either invoke it directly, having marked it executable:

./index.js

Or hand it to osascript explicitly, with no chmod required:

osascript -l JavaScript index.js

A Finder chooser appears with the list of examples. Open the relevant application first (for instance, FaceTime for the block-list example) and then click OK.

See CONTRIBUTING.md for build and development instructions.