2014-09-13 50 views
0

因此,我對iMessage的「iTunes Remote Control.applescript」進行了大量的改動,將我的手機用作iTunes的遙控器。在iTunes中使用iMessage和AppleScript播放藝術家

我被困在一個點,我想用我的手機發送一條消息,如「Artist Eminem」或我的圖書館中的任何其他藝術家,並讓它在iTunes中播放。

這就是我現在所擁有的,但我需要一個字符串變量來存儲「Artiest」之後的部分,然後讓iTunes播放該特定的字符串(藝術家)名稱。

否則,如果theMessage是「Artiest」然後(我在這裏需要一些存儲到一個字符串方法)

tell app "iTunes" 
     play (every track of library playlist 1 whose artist is "<artist stored in string>") 
end tell 

有誰知道這是可能的,如果是的話,我將如何做到這一點?

回答

0
set x to "Artist Bryan Adams" 

set y to offset of " " in x 
set artist to characters (y + 1) thru -1 in x as string 

藝術家被設置爲「布萊恩亞當斯」

tell application "iTunes" 
    set mySongs to every track of library playlist 1 whose artist is artist 
    play item 1 of mySongs 
end tell 

這將播放歌手的第一首曲目。所以如果你已經按照藝術家的順序排列它們,它會播放所有那些藝術家的歌曲不是一個優雅的解決方案,但它是一些東西

相關問題