run-applescript

Run AppleScript and get the result

MIT 13 个版本
安装
npm install run-applescript
yarn add run-applescript
pnpm add run-applescript
bun add run-applescript
README

run-applescript

Run AppleScript and get the result

Install

npm install run-applescript

Usage

import {runAppleScript} from 'run-applescript';

const result = await runAppleScript('return "unicorn"');

console.log(result);
//=> 'unicorn'

API

runAppleScript(script, options?)

Returns a Promise<string> with the script result.

script

Type: string

The script to run.

options

Type: object

humanReadableOutput

Type: boolean
Default: true

Change the output style.

When false, returns the value in a recompilable source form.

signal

Type: AbortSignal

An AbortSignal that can be used to cancel the AppleScript execution.

runAppleScriptSync(script, options?)

Returns a string with the script result.

script

Type: string

The script to run.

options

Type: object

humanReadableOutput

Type: boolean
Default: true

Change the output style.

When false, returns the value in a recompilable source form.

  • run-jxa - Run JXA code and get the result
版本列表
7.1.0 2025-09-09
7.0.0 2023-12-18
6.1.0 2022-12-12
6.0.0 2021-08-12
5.0.0 2021-03-07
4.0.0 2019-10-28
3.2.0 2018-07-20
3.1.0 2017-12-25
3.0.0 2016-04-26
2.1.0 2015-11-14
2.0.0 2015-10-05
1.0.1 2014-08-18
1.0.0 2014-08-18