使用iTunes的Up Up功能和API

NSA*_*ict 8 macos xcode cocoa itunes objective-c

有没有办法使用iTunes的Up Up功能和API?

我知道您可以使用Scripting Bridge,但它不包括iTunes 11的任何新功能.

Dai*_*jan 6

iTunes没有公共API,而是脚本桥

你可以使用Applesript UI Scripting我下注 - 但那将是非常脆弱的

你也可以模拟一个按键:
它比脚本化可见界面(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
Run Code Online (Sandbox Code Playgroud)