2013-05-19 20 views
1

我正在尝试编写一个脚本,该脚本可以让我根据曲目标题将一个专辑版本的播放次数复制到另一个版本。iTunes - 制作用于复制专辑播放计数的脚本

基本上情况是,我的计算机上有专辑以及所有playcounts。然后我以更高的质量重写原始CD(以前我的质量偏好非常低)。

现在我想自动复制我旧的蹩脚的质量撕裂playcounts到新的高品质的。

我采用了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 

回答

0

我想通了这一点,原来的问题是,有没有这样的事,作为一个轨道的title,财产被称为轨道的name

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