Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

readme++

  • Loading branch information...
commit 27ac532131da3f25ba779873e55c26ca6959ecaa 1 parent 7cb5752
@TooTallNate authored
Showing with 20 additions and 16 deletions.
  1. +20 −16 README.md
View
36 README.md
@@ -12,7 +12,9 @@ external OS X processes, for example [iTunes](http://www.itunes.com).
Easy Install
------------
- npm install applescript
+``` bash
+$ npm install applescript
+```
Requirements
------------
@@ -26,22 +28,24 @@ Usage
The `node-applescript` module provides `execString` and `execFile` functions
to easily execute AppleScript commands and buffer the output into a calback.
- var applescript = require("applescript");
-
- // Very basic AppleScript command. Returns the song name of each
- // currently selected track in iTunes as an 'Array' of 'String's.
- var script = 'tell application "iTunes" to get name of selection';
-
- applescript.execString(script, function(err, rtn) {
- if (err) {
- // Something went wrong!
- }
- if (Array.isArray(rtn)) {
- rtn.forEach(function(songName) {
- console.log(songName);
- });
- }
+``` js
+var applescript = require("applescript");
+
+// Very basic AppleScript command. Returns the song name of each
+// currently selected track in iTunes as an 'Array' of 'String's.
+var script = 'tell application "iTunes" to get name of selection';
+
+applescript.execString(script, function(err, rtn) {
+ if (err) {
+ // Something went wrong!
+ }
+ if (Array.isArray(rtn)) {
+ rtn.forEach(function(songName) {
+ console.log(songName);
});
+ }
+});
+```
`execFile` works the exact same way, except you pass the _path_ of the AppleScript
(`*.applescript`) file as the first argument instead of the command itself, and you
Please sign in to comment.
Something went wrong with that request. Please try again.