escape-string-applescript

Escape a string for use in AppleScript

MIT License

Downloads
1.2M
Stars
10
Committers
2

escape-string-applescript

Escape a string for use in AppleScript

According to the AppleScript docs, \ and " have special meaning and should be escaped.

Install

$ npm install escape-string-applescript

Usage

import {execFile} from 'child_process';
import escapeStringAppleScript from 'escape-string-applescript';

const string = escapeStringAppleScript('"i like unicorns"');
//=> '\"i like unicorns\"'

const script = `set unicornMessage to "${string}"`;

execFile('osascript', ['-e', script]);

Related

Package Rankings
Top 17.23% on Bower.io
Top 3.59% on Npmjs.org