wangzhibo
2026-05-09 53418655c061ac26f66058253f39200aced1ab1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
export type Options = {
    /**
    Change the output style.
 
    When `false`, returns the value in a [recompilable source form](https://ss64.com/osx/osascript.html).
 
    @default true
 
    @example
    ```
    import {runAppleScript} from 'run-applescript';
 
    const result = await runAppleScript('return "unicorn"', {humanReadableOutput: false});
 
    console.log(result);
    //=> '"unicorn"'
    ```
    */
    readonly humanReadableOutput?: boolean;
 
    /**
    An AbortSignal that can be used to cancel the AppleScript execution.
 
    Only supported by the async function.
    */
    readonly signal?: AbortSignal;
};
 
/**
Run AppleScript asynchronously.
 
@param script - The script to run.
@returns The script result.
 
@example
```
import {runAppleScript} from 'run-applescript';
 
const result = await runAppleScript('return "unicorn"');
 
console.log(result);
//=> 'unicorn'
```
*/
export function runAppleScript(
    script: string,
    options?: Options
): Promise<string>;
 
/**
Run AppleScript synchronously.
 
@param script - The script to run.
@returns The script result.
 
@example
```
import {runAppleScriptSync} from 'run-applescript';
 
const result = runAppleScriptSync('return "unicorn"');
 
console.log(result);
//=> 'unicorn'
```
*/
export function runAppleScriptSync(script: string, options?: Options): string;