Question

This applescript

tell application "iTunes"
set new_playlist to get first user playlist whose id is 20721
set nexttrack to (add(POSIX file ( get "/Users/paul/tmp/Music4/My Bloody Valentine - m b v - 2013 [FLAC][24-96][WEB]/09 Wonder 2.flac") as alias) to new_playlist)
set trackname to name of nexttrack
end tell

fails with

javax.script.ScriptException: The variable nexttrack is not defined.

I think the line before is the problem but I cant see what is wrong with it. (Note the starting point is the filenames are provided in unix / notation)

Was it helpful?

Solution

Try:

set songAlias to alias (POSIX file "/Users/paul/tmp/Music4/My Bloody Valentine - m b v - 2013 [FLAC][24-96][WEB]/09 Wonder 2.flac")

tell application "iTunes"
    set new_playlist to get first user playlist whose id is 20721
    set nexttrack to add songAlias to new_playlist
    set trackname to name of nexttrack
end tell
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top