[localhost:~]$ cat * > /dev/ragfield

Wednesday, October 21, 2009

Play a specific track in iTunes from Mathematica

A coworker was making a presentation and asked me for a function he could trigger with Button[] to start playing a specific track in iTunes (on a Mac). This gets the job done:
iTunesPlay[playlist_String, track_Integer] := Run[StringJoin[
        "osascript -e 'tell application \"iTunes\" to play track ",
        ToString[track], " of user playlist \"", playlist, "\"'"
]];
iTunesPlay["Mix", 1]
iTunesPlay["Mix", 2]

1 comment:

Kimberly Cox said...

To listening my favorite podcasts and music I use iTunes for Mac software to manage, as iTunes portable latest download https://yepdownload.com/itunes-portable for my pc. It totally makes my day. I select music in the most thorough way, and in my playlist only the newest sound. Better app for all times. Try to use it some day.