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

Applescript iTunes--制作用于复制专辑播放计数的脚本,applescript,itunes,Applescript,Itunes,我正在尝试写一个脚本,让我可以根据曲目的标题将一个版本的专辑的播放次数复制到另一个版本 基本上,情况是我的电脑上有相册和所有播放计数。然后我以更高的质量重新翻印了原始CD,之前我的质量偏好非常低 现在,我想自动将旧的劣质撕裂的播放次数复制到新的高质量撕裂 我采用了Doug Adams的一个脚本来尝试这样做,但当我尝试运行它时,它只会给我一个描述符类型不匹配。没有任何关于问题所在线路的指示 我以前从未使用过苹果脚本;有人知道问题出在哪里吗 global thismany tell applicat

我正在尝试写一个脚本,让我可以根据曲目的标题将一个版本的专辑的播放次数复制到另一个版本

基本上,情况是我的电脑上有相册和所有播放计数。然后我以更高的质量重新翻印了原始CD,之前我的质量偏好非常低

现在,我想自动将旧的劣质撕裂的播放次数复制到新的高质量撕裂

我采用了Doug Adams的一个脚本来尝试这样做,但当我尝试运行它时,它只会给我一个描述符类型不匹配。没有任何关于问题所在线路的指示

我以前从未使用过苹果脚本;有人知道问题出在哪里吗

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

我明白了,问题是没有曲目的标题,这个属性叫做曲目的名称

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