我正在尝试使用 AppleScript设置用户播放列表的曲目。我不希望添加曲目,我希望它们替换当前曲目。在我这样做之前,我需要通过它们的持久 ID 查找轨道,这工作正常,但是设置轨道的语句不起作用。下面的代码片段:
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)
另外,如何从播放列表中删除所有曲目(即设置为空列表)?