【问题标题】:How to count checked items in iTunes using Applescript如何使用 Applescript 计算 iTunes 中的已检查项目
【发布时间】:2013-03-06 11:43:33
【问题描述】:

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

这行得通。

但我想做的是让它只检查已检查歌曲的库。但是,当我在末尾(第三个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 在行尾出现了一些神秘的事情。显然我检查不正确

【问题讨论】:

    标签: applescript itunes


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 2016-02-28
      • 2013-10-01
      • 2017-05-30
      • 2011-06-04
      • 2010-11-03
      • 1970-01-01
      • 2015-08-31
      • 2010-12-28
      • 2012-06-26
      相关资源
      最近更新 更多