首页 > 解决方案 > 基本的 iTunes AppleScript 问题

问题描述

感觉就像一个真正的骨头,只是想弄清楚如何让这个脚本从艺术家的选择中插入名称并将其放入专辑艺术家。

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

标签: applescriptitunes

解决方案


像这样:

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)

推荐阅读