HomeBlog Page

iTunes (Mac) で Play Count を変更する AppleScript 

iTunes の 演奏回数 (Play Count) は通常変更できないのだが、AppleScript を使えばできるようなので作成した。

 

iTunes で時々 Play Count を変更したいことがあるんだけど、通常、リセット以外の変更はできないようになっている。不便なので、なんとか簡単に変更する方法は無いかと調べてみると、AppleScript を使えば変更できることがわかった。

http://members.at.infoseek.co.jp/obto/script/script3.html

ここにあるスクリプトを利用すれば、Play Count を変更できる...が、このままだと、1〜20までしか変更できない。これだとまだまだ不便なので、ダイアログから数値入力できるように改造した。[1行変更しただけ ;)]

tell application "iTunes"
    try
        set trk to {}
        set slct to a reference to selection
        if slct as list is {} then return
        repeat with x in slct
            set end of trk to (name of x as Unicode text) & (" (" & played count of x & ")")
        end repeat
        set AppleScript's text item delimiters to ", "
        set y to text returned of (display dialog "Change Play Count" default answer "1")
        set played count of slct to y
    end try
end tell
-- original script
-- http://members.at.infoseek.co.jp/obto/script/script3.html

使い方は、以下の通り。
(1) 上記のスクリプトを ScriptEditor で作成
(2) ~/Library/iTunes/Scripts/ フォルダに保存
(3) Play Count を変更したい曲を iTunes で選択
(4) iTunes のスクリプトメニューから上記スクリプトを選択
(5) ダイアログが出てくるので、所望の値を入力
(6) OK ボタンを押す