如何使用Applescript搜索iTunes?

如何使用Applescript搜索iTunes?,applescript,Applescript,如何搜索符合特定条件的每首歌曲?例如,类似于: 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 就像那样,除了两件事;首先,tracks是iT

如何搜索符合特定条件的每首歌曲?例如,类似于:

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

就像那样,除了两件事;首先,tracks是iTunes脚本字典中的一个保留词,所以用其他词代替它,例如ts;第二,你不能仅仅把一个音轨转换成一个以t为字符串的字符串;你必须选择你想要的信息。例如,如果需要名称,可以使用t的名称作为字符串;如果你想要更多的细节,你可以做t的名字和t的艺术家;还请注意,如果您想要一个更复杂的谓词,您可以将其附加到WHERS子句上;例如,文件跟踪的名称包含Green,而艺术家包含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

删除播放列表库可能会产生稍有不同的结果,但可能不会。在我的快速测试中它没有出现。

就像那样,除了两件事;首先,tracks是iTunes脚本字典中的一个保留词,所以用其他词代替它,例如ts;第二,你不能仅仅把一个音轨转换成一个以t为字符串的字符串;你必须选择你想要的信息。例如,如果需要名称,可以使用t的名称作为字符串;如果你想要更多的细节,你可以做t的名字和t的艺术家;还请注意,如果您想要一个更复杂的谓词,您可以将其附加到WHERS子句上;例如,文件跟踪的名称包含Green,而艺术家包含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

删除播放列表库可能会产生稍有不同的结果,但可能不会。在我的快速测试中它没有出现。

啊,谢谢你指出它是一个保留字。改变它成功了。谢谢啊,谢谢你指出这是一个保留字。改变它成功了。谢谢