2013-11-04 54 views
0

這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 /符號提供的文件名)

回答

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 
+0

這可能已經取得了一些差林不知道會標記爲正確的。但我在我的例子中意識到我使用的是flac文件,而iTunes不支持flac。 –