Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmd committed May 4, 2019
1 parent 9aa1b23 commit 611b562
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ The `osascript-tag` can be used in one of the following ways:

### `osascript`

Executes an AppleScript.
Executes the given OSA script.

##### Example

```js
osascript`
const result = await osascript`
tell application "Finder"
name of every file of the desktop
end tell
Expand All @@ -136,12 +136,12 @@ A `Promise` that resolves with the script's standard output, or rejects with an

### `osascript(options: Options)`

Executes an AppleScript with custom options.
Executes the given OSA script with custom options.

##### Example

```js
osascript({ flags: 'so' })`
const result = await osascript({ flags: 'so' })`
tell application "Finder"
name of every file of the desktop
end tell
Expand All @@ -164,12 +164,12 @@ An instance of [`osascript`](#osascript) configured with the provided options.

### `osascript.jxa`

A convenient wrapper for `osascript` pre-configured to run JXA.
A convenient wrapper for `osascript` configured to run JXA.

##### Example

```js
osascript.jxa`
await osascript.jxa`
const app = Application.currentApplication();
app.includeStandardAdditions = true;
app.displayAlert('This is a message');
Expand All @@ -187,7 +187,7 @@ Executes a JXA script with custom options.
##### Example

```js
osascript.jxa({ parse: true })`
const result = await osascript.jxa({ parse: true })`
const app = Application('iTunes');
return {
artist: app.currentTrack.artist(),
Expand All @@ -204,8 +204,8 @@ osascript.jxa({ parse: true })`
- `s` Return values in recompilable source form.
- `e` Redirect script errors to stderr (default)
- `o` Redirect script errors to stdout.
- `parse?: boolean` - A boolean indicating whether the standard output of the script is parsed for consumption in JavaScript. This uses `JSON.parse` under the hood. **Note that setting this option to true, will automatically set the `flags` option to `"se"`**. Defaults to `false`.
- `argv?: any[]` - An array of arguments to be passed to the script. This array will be available in the JXA script text as a global variable `argv`. Please note that all values will be serialized to strings.
- `parse?: boolean` - A boolean indicating whether the standard output of the script is parsed for consumption in JavaScript. This uses `JSON.parse` under the hood. **Note that setting this option to true will automatically set the `flags` option to `"se"` if not set explicitly otherwise**. Defaults to `false`.
- `argv?: any[]` - An array of arguments to be passed to the script. This array will be available in the JXA script itself as a global variable `argv`. Please note that all values will be serialized to strings.

##### Returns

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osascript-tag",
"description": "A JavaScript template literal tag that executes AppleScript and other OSA languages",
"description": "A JavaScript template literal tag that executes OSA scripts (AppleScript, JavaScript, etc.)",
"version": "0.1.0",
"author": "Waseem Dahman <dwaseem@icloud.com>",
"license": "MIT",
Expand Down

0 comments on commit 611b562

Please sign in to comment.