0

因此,我正在使用 iMessage 的“iTunes Remote Control.applescript”来将我的手机用作 iTunes 的遥控器。

我被困在一个地方,我想用我的手机发送一条消息,比如“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

有谁知道这是否可行,如果可以,我将如何做到这一点?

4

1 回答 1

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

这将播放该艺术家的第一首曲目。因此,如果您根据艺术家订购了它们,它将播放所有艺术家的歌曲。不是一个优雅的解决方案,但它是一些东西。

于 2014-09-14T15:29:02.207 回答