8

iTunesのUpNext関数をAPIで使用する方法はありますか?

Scripting Bridgeを使用できることは知っていますが、iTunes11の新機能は含まれていません。

4

1 に答える 1

6

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
于 2012-12-01T12:53:13.233 に答える