【问题标题】:Playing an artist in iTunes using iMessage and AppleScript使用 iMessage 和 AppleScript 在 iTunes 中播放艺术家
【发布时间】:2014-09-13 13:06:52
【问题描述】:

所以我正在为 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

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

【问题讨论】:

    标签: applescript itunes imessage


    【解决方案1】:
    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
    

    艺术家设置为“Bryan Adams”

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多