You can execute any music file in the default player - that's a user choice per individual file or per file type, default will be iTunes:
File("~/Music/iTunes/iTunes Media/Music/Georges Arvanitas Trio/Jazz Loves Paris By Night - Piano & Hammond Organ/02 Aquarella.m4a").execute();
That execute() should even work on a PC.
To remote control iTunes:
app.doScript('tell application "iTunes" to play track "Aquarella"',ScriptLanguage.APPLESCRIPT_LANGUAGE);
app.doScript('tell application "iTunes" to stop',ScriptLanguage.APPLESCRIPT_LANGUAGE);
Do you still need playlists?
Having a deeper look at your code, I see you're targeting ESTK. ESTK has no app.doScript(), for there I'd just compile the single line AppleScript into a mini application and execute that.
hmm...I think it's going to be more complicated than I thought.
correct, this script targets the ESTK, it is part of a larger Illustrator script, which doesn't have doScript either...I would go with applescript as last resort. I think going with the playlist file is easier.
based on your comment I realized users might change their default players, so on Windows I'm going to change the playlist file from *.wpl to the more universal *.m3u, I guess whatever decent player made the default, supports this file.
so, will an *.m3u playlist file play on the default mac player (itunes) when executed?
File("~/Music/iTunes/iTunes Media/Music/emptyPlaylist.m3u").execute(); // will this play on itunes?
I noticed that the *.m3u file can be blank, it will still "play" when executed() and effectively "stops" any music file currently being played...if this happens on Mac also, that's what I'm after.
thanks for helping Dirk.
iTunes wouldn't let me export an empty playlist.
The following three lines is the .m3u playlist of the previously mentioned track:
#EXTINF:179,Aquarella - Georges Arvanitas Trio
/Users/dirk/Music/iTunes/iTunes Media/Music/Georges Arvanitas Trio/Jazz Loves Paris By Night - Piano & Hammond Organ/02 Aquarella.m4a
If I launch that playlist file, iTunes aborts the current track and plays the playlist.
If I remove lines 2+3, iTunes ignores the playlist.
If I edit line 3 to a bogus file reference, iTunes ignores the playlist.
Btw, iTunes considers the "repeat" setting - so if the track is a second of silence, it will be repeated forever.
Hi Dirk, then if itunes won't stop the current file when executing and empty playlist then I'm going with distributing a 1 second of silence file along with my script.
thanks for your help.