将 iTunes 的 Up Next 函数与 API 结合使用



有没有办法将iTunes的Up Next函数与API一起使用?

我知道您可以使用脚本桥,但它没有涵盖iTunes 11的任何新功能。

iTunes没有公共API,只有脚本桥

你可以使用Applesript UI脚本,我敢打赌 - 但那将非常脆弱

您还可以模拟按键,然后:
这比编写可见界面 (IMO) 脚本更不脆弱:
http://hints.macworld.com/article.php?story=20121203223100335

TADA -- YAY -- 一个"就绪"脚本,可将所选歌曲添加到 UpNext ::

tell application "AppleScript Utility"
    set GUI Scripting enabled to true
end tell
tell application "iTunes"
    --get the song
    set l to playlist "Purchased"
    set t to item 5 of tracks of l
    --focus it in list
    reveal t
    --show window
    activate
end tell
tell application "System Events"
    -- option enter
    delay 1
    key down option
    delay 1
    key code 36
    key up option
    -- Click the “Play Song” button in the annoying dialog.
    set w to null
    try
        set w to window "Add to Up Next" of application process "iTunes"
    end try
    if w is not null then
        set b to UI element "Play Song" of w
        click b
    end if
end tell

最新更新