无法将文件名转换为别名

时间:2013-11-04 17:56:32

标签: applescript itunes

这个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

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

我认为之前的问题是问题,但我不知道它有什么问题。 (注意起点是文件名以unix / notation提供)

1 个答案:

答案 0 :(得分:0)

尝试:

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