Tuesday May 07, 2013

Playing ITunes from Nashorn

If you are on Mac OS X, it's possible to use Apple Script from Nashorn.  For example if you want to play a song in iTunes, the following script will do it;

#!/usr/bin/jjs -scripting
#
var song = "Bring It On Home";

$EXEC("/usr/bin/osascript", <<<EOD);
tell application "iTunes"
	activate
	play track "${song}" in playlist 1
end tell
EOD

About

Technical discussions and status of the Nashorn JavaScript Project.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
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
   
       
Today