用于复制文件和添加到iTunes播放列表不起作用的Applescript

时间:2011-12-21 14:35:40

标签: applescript itunes

我在尝试从一个itunes播放列表中获取曲目并将其添加到另一个新创建的播放列表时遇到问题,现在它已经用于工作但它不知道它是否根本不起作用或仅仅在我的测试中情况下

这是我的测试:

tell application "iTunes"
    set mainlibrary to library playlist 1
    set list_of_folders to get every folder playlist
    set new_playlistfolder to item 1 of list_of_folders
    set new_playlist to (make user playlist in new_playlistfolder with properties {name:"TestPlayList"})
    try
        set existtrack to (first file track of mainlibrary whose database ID = 14265)
        duplicate existtrack to new_playlist

    on error err_mess
        log err_mess
    end try
end tell

这是我在Applescript编辑器中运行它时得到的结果

tell application "iTunes"
    get library playlist 1
        --> library playlist id 14395 of source id 72
    get every folder playlist
        --> {folder playlist id 27010 of source id 72, folder playlist id 29459 of source id 72}
    make with properties {name:"TestPlayList"} at folder playlist id 27010 of source id 72 new user playlist
        --> user playlist id 29721 of source id 72
    get file track 1 of library playlist id 14395 of source id 72 whose database ID = 14265
        --> file track id 20505 of library playlist id 14395 of source id 72
    copy file track id 20505 of library playlist id 14395 of source id 72 to user playlist id 29721 of source id 72
        --> error number -1708
    (*iTunes got an error: Can’t set user playlist id 29721 of source id 72 to file track id 20505 of library playlist id 14395 of source id 72.*)
end tell

任何想法。

感谢保罗

2 个答案:

答案 0 :(得分:0)

我不是一个大专家,但我有一个类似的脚本,而不是

(...)
duplicate existtrack to new_playlist
(...)

我有:

(...)
set t to (get location of existtrack)
add t to new_playlist
(...)

会有帮助吗?

答案 1 :(得分:0)

我相信你需要写下这一行:

duplicate existtrack to new_playlist

为:

duplicate existtrack to playlist new_playlist