如何搜索符合特定条件的每首歌曲?例如:
tell application "iTunes"
set tracks to (every file track of playlist "Library" whose name contains "Green")
repeat with t in tracks
display dialog (t as string)
end repeat
end tell
答案 0 :(得分:4)
就像那样,除了两件事;首先,tracks
是iTunes脚本词典中的保留字,因此将其替换为其他内容(例如 ts
);第二,你不能只用t as string
将曲目转换为字符串;你必须选择你想要的信息。例如,如果您想要名称,可以使用name of t as string
;如果你想要更多细节,你可以做name of t & " - " & artist of t
;另请注意,如果您想要更复杂的谓词,可以将其添加到whose
子句中;例如,file tracks whose name contains "Green" and artist contains "Bird"
。
如果您想稍微打高级脚本,可以使用以下内容替换它:
tell application "iTunes"
repeat with t in (file tracks whose name contains "Green")
display dialog (name of t as string)
end repeat
end tell
删除of playlist "Library"
可能会产生稍微不同的结果,但可能不会。它没有在我的快速测试中。