2
我正在嘗試使用AppleScript設置用戶播放列表的曲目。我不希望添加曲目,我希望他們替換當前曲目。在我這樣做之前,我需要通過它們的持久ID來查找軌跡,這些軌跡工作正常,但設置軌跡的語句不起作用。代碼片段如下:如何使用AppleScript在iTunes中設置播放列表的曲目?
set fixed indexing to true
set myPlaylist to the first item of (every user playlist whose persistent ID is "5C768EFF306E3366")
set tracksPIDs to {"66EB935073027EDD", "B6807694FEDD76B4"}
set resolvedTracks to {}
--resolve the tracks
repeat with trackPID in tracksPIDs
set myTrack to the first item of (every track whose persistent ID is equal to trackPID)
set end of resolvedTracks to myTrack
end repeat
set (the tracks of my myPlaylist) to duplicate of (resolvedTracks)
此外,如何從播放列表中刪除所有曲目(即其設置爲空列表)?
這並不爲我工作。每當我嘗試用一系列曲目而不是內嵌參考(`...的每一首...')來調用`duplicate`時,AppleScript會說「無法將myPlaylist設置爲{...}」或類似。 – 2016-10-23 23:34:46