-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (21 loc) · 721 Bytes
/
index.js
File metadata and controls
25 lines (21 loc) · 721 Bytes
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
// (C)opyright 2017-04-25 Dirk Holtwick, holtwick.it. All rights reserved.
// https://github.com/TooTallNate/node-applescript
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 "Receipts Space" to export as json'
applescript.execString(script, function (err, rtn) {
if (err) {
console.log(err)
return
}
let data = JSON.parse(rtn)
data.items.forEach(function (item) {
console.log(
item.date ? item.date.slice(0, 10) : '?',
item.amounts.gross,
item.amounts.currency,
item.provider ? item.provider.title : '?'
)
})
})