iTunes - 制作用于复制专辑播放计数的脚本

时间:2013-05-19 04:46:58

标签: applescript itunes

我正在尝试编写一个脚本,让我根据曲目的标题将一个版本的专辑的剧本复制到另一个版本。

基本上,情况是我的电脑上有相册以及所有的游戏计数。然后我将原始CD重新打印出来(以前我的质量偏好非常低)。

现在我想自动将旧的蹩脚质量撕裂的游戏数量复制到新的高品质游戏中。

我采用了Doug Adams的一个脚本来尝试这样做,但是当我尝试运行它时,它只是让我“发生描述符类型不匹配”。没有任何迹象表明问题所在。

我之前从未使用过Apple Script;有人知道问题出在哪里吗?

global thismany
tell application "iTunes"
    if selection is not {} then
        set sel to selection
        repeat with t in sel
            set t to contents of t
            if class of t is file track or class of t is URL track then
                if played count of t is 0 then
                    set thismany to 0
                    repeat with t2 in sel
                        set t2 to contents of t2
                        if class of t2 is file track or class of t2 is URL track then
                            if title of t is equal to title of t2 and t2 is not t then
                                set thismany to played count of t2
                                exit repeat
                            end if
                        end if
                    end repeat
                    set played count of t to (thismany as integer)
                    if (thismany as integer) is 0 then
                        try
                            set played date of t to missing value
                        end try
                    end if
                end if
            end if
        end repeat
    else -- no track selected
        tell me to message_and_cancel("No tracks selected.")
    end if
end tell

1 个答案:

答案 0 :(得分:0)

我认为这一点,结果表明问题在于没有轨道title这样的东西,该属性被称为轨道的name

如果有人感兴趣,现在可以找到完整的脚本here