【问题标题】:How to get iTunes to play an iPhone playlist automatically when connected to the iPhone如何让 iTunes 在连接到 iPhone 时自动播放 iPhone 播放列表
【发布时间】:2013-03-20 13:02:43
【问题描述】:

我有一边听音乐一边工作/学习的习惯。而且由于我在工作时连接的 Mac 没有我想要的所有歌曲,我通常通过 iTunes 从 iPhone 播放列表选项收听歌曲。

为此,每次我将 iPhone 连接到计算机时,iTunes 都会检测到它,然后我必须手动转到应用程序中的“iPhone”按钮,然后“在我的 iPhone 上”,然后选择播放列表,然后播放一首歌。

是否有自动化这个过程?我正在寻找的是,一旦我连接我的 iPhone,iTunes 应该会自动打开我 iPhone 中的播放列表,并开始随机播放一首歌曲。

我尝试使用 Automator 将其自动化。但这似乎不起作用。我在 AppleScript 中做错了 ::

tell application "iTunes"
    play playlist named "Sasha" of source of type iPhone
end tell

【问题讨论】:

  • 出于好奇,为什么这被否决了?我找了很久才找到解决方案,最后自己编写了代码,并将解决方案呈现给世界。这种事情正是 StackOverflow 存在的原因。
  • 可能更适合询问不同的堆栈交换是我对 downvote 的猜测
  • 但这实际上是一个关于 Applescript 的编码问题(这是该社区公认的标签)。

标签: macos applet applescript itunes automated-deploy


【解决方案1】:

哈!!我想到了 !!然后我创建了一个小程序,它可以使用 AppleScript 为我完成这项工作。

然后,我在下面的博客上发布了相同的步骤/代码。这是链接::

Explanation of Code :: How to start playing songs from your iOS device automatically on your Mac

和相同的代码::

tell application "iTunes"

    set theCurrentPlaylist to view of front browser window
    set myiPhone to some source whose kind is iPod
    set mainPhonePlaylist to playlist "Sasha" of myiPhone
    set the view of the front browser window to mainPhonePlaylist
    set EQ enabled to true

    play playlist named "Sasha" of myiPhone
    set myRandomSong to random number from 1 to count of tracks of (get view of front window)
    play track myRandomSong of mainPhonePlaylist

end tell

【讨论】:

    猜你喜欢
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 2019-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多