2011-10-04 111 views
2

我試圖運行一個將在iTunes中播放歌曲的Applescript。問題是我需要這首歌來擁有一位特定的藝術家。每當我寫一些使用「藝術家」的劇本時,我會得到一個錯誤,指出藝術家無法訪問。AppleScript在iTunes中與特定藝術家一起播放歌曲?

tell application "iTunes" 
activate 
play track "My Song" 
end tell 

此代碼可用於播放曲目,但我也需要指定藝術家,以便不會意外播放具有相同名稱的曲目。任何幫助是極大的讚賞。

感謝,

山姆

回答

2

根據需要調整。

tell application "iTunes" 
    set mySongs to every track of library playlist 1 whose artist is "Styx" and name is "boat on the river" 
    repeat with aSong in mySongs 
     play aSong 
    end repeat 
end tell 
相關問題