基本的 iTunes AppleScript 问题

Basic iTunes AppleScript issue

感觉自己像个白痴,只是想弄清楚如何让这个脚本插入艺术家中选择的名字并将其放入专辑艺术家中。

tell application "iTunes"
  set theTracks to (item 1 of (get selection))
  set theTracks to selection
  repeat with theTrack in theTracks
    set albumartist to artist of theTrack
  end repeat
end tell

像这样:

tell application "iTunes"
    set theTracks to (item 1 of (get selection))
    set theTracks to selection
    repeat with theTrack in theTracks
        set albumartist to artist of theTrack
        set album artist of theTrack to albumartist -- the missing line
    end repeat
end tell

在现实生活中我可能会跳过中间变量并将这对行写成一行,如下所示:

        set album artist of theTrack to (get artist of theTrack)

甚至更好:

        tell theTrack to set album artist to (get artist)