All languages

JavaScript OSA languagehistorical

Freeware Macintosh scripting language embedding Mozilla's SpiderMonkey engine into Apple's Open Scripting Architecture (2001) — JavaScript as an AppleScript alternative, with Core/MacOS host objects and Apple-event bindings.

Overview

JavaScript OSA plugged JavaScript — Mozilla's SpiderMonkey core — into the Mac's Open Scripting Architecture as a freeware AppleScript alternative by Late Night Software. Scripts spoke to applications through Apple events instead of a browser DOM.

Code

// JavaScript OSA: host objects bind to Mac applications via Apple events.
const Finder = MacOS.app("Finder");

const disk = Finder.disks.byName("Macintosh HD");
disk.desktopPosition = { x: 100, y: 40 };

// AppleScript-style targets, JavaScript syntax:
const name = Finder.name;

console.log("Frontmost app: " + MacOS.frontmost.name);
Paraphrased from the documented Core/MacOS object model — application objects arrive as Apple-event bindings; the core language is stock SpiderMonkey JavaScript.

Distinctive traits

  • Host objects, not a browser: Core and MacOS objects wrap Apple events; no DOM anywhere.
  • Same core language as Netscape's engine — JS semantics with none of the web platform.
  • Script Debugger integration: bundled with the flagship editor; scriptable like any OSA component.

Status

Historical: released 2001, an alpha second version (2005) bundled with Script Debugger 4, then dropped from Script Debugger 5 in 2012 for lack of interest. Apple's JavaScript for Automation (JXA, 2014) later took the JavaScript-scripting niche system-wide.

Sources & references