0

我正在尝试创建一个小脚本,该脚本获取所选项目的列表并计算每个所选项目在库中其他地方出现的次数。如果有重复,它会关闭复选标记,如果这是唯一的副本,它会打开它。

这行得通。

但我想做的是让它只检查已检查歌曲的库。但是当我在(第三行的)末尾添加“启用”位时set,脚本超时。

repeat with entry in selection -- "selection" is a concept implemented in iTunes 
    set a to artist of entry
    set n to name of entry
    set x to count of (file tracks whose name contains n and artist contains a and enabled is true)
    ...
    display dialog x
end repeat

如果我取出and enabled is true它,它会按预期以双倍的速度完成,并且结果符合预期。

and enabled is true在行的末尾,发生了一些神秘的事情。显然我检查不正确

4

1 回答 1

1

这是一个快速的解决方法:

tell application "iTunes"
    repeat with entry in selection -- "selection" is a concept implemented in iTunes 
        set a to artist of entry
        set n to name of entry
        set myTracks to (file tracks whose name contains n and artist contains a)
        set x to {}
        repeat with aTrack in myTracks
            if aTrack's enabled = true then set end of x to aTrack
        end repeat
        display dialog (count x)
    end repeat
end tell
于 2013-03-06T14:08:06.890 回答