Applescript改变当前在iTunes中播放的歌曲的评级

Bra*_*ham 4 applescript itunes

我设置了一个改变iTunes中当前歌曲评级的AppleScript,它在前几次有效,但现在什么也没做.这是代码:

tell application "System Events"
    if (name of processes) contains "iTunes" then
        set iTunesRunning to true
    else
        set iTunesRunning to false
    end if
end tell

if iTunesRunning then
    tell application "iTunes"
        repeat with theTrack in (get selection)
            set the rating of theTrack to 100
        end repeat
    end tell
end if
Run Code Online (Sandbox Code Playgroud)

有人在那里看到任何明显的问题吗?仅供参考,这是一个全球热键,但即使在Applescript编辑器中打开它并点击"Run"也不会做任何事情.

Bra*_*ham 7

确认.我所要做的就是要求自己找到答案.

tell application "System Events"
    if (name of processes) contains "iTunes" then
        set iTunesRunning to true
    else
        set iTunesRunning to false
    end if
end tell

if iTunesRunning then
    tell application "iTunes"
        set rating of current track to 100
    end tell
end if
Run Code Online (Sandbox Code Playgroud)