AppleScriptでアートワークに画像を差し込むまで
アルバムにアートワークをつける作業で時間がかかるのが画像を探すことと,それを反映させるところです.前回の記事では画像をダウンロードするところまでしたので今回は画像を反映させてみたいと思います.
iTunes10.2から仕様が変わっていたのに気付かず,画像をPICTに変換するところで戸惑ってました.しかし10.2からは直接画像を差し込むことができるようになったのでかなり簡単になりました.
tell application "iTunes" to set theAlbum to album of item 1 of selection set theDestination to "" --PATH set targetImageFile to theDestination & ":" & theAlbum & ".png" tell application "iTunes" set theTrack to selection repeat with i in theTrack set data of artwork 1 of i to (read (file targetImageFile) as picture) end repeat end tell
これでアルバム全体にアートワークを差し込むことができます.