- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下脚本将在 iTunes 中打开一个轨道
use application "iTunes"
property trackURL : "itmss://itunes.apple.com/us/album/brahms-violin-concerto-in-d-major-op-77-iii-allegro/145533236?i=145533044&uo=4"
open location trackURL
现在,要求“iTunes”播放它不起作用,因为轨道已突出显示但未正确选择,即需要手动单击鼠标才能选择并播放。
如何选择突出显示的轨道?或者我怎么能让“iTunes”播放这首歌?!或者,是否可以通过 URL 直接将音乐添加到我的音乐库?
最佳答案
免责声明:我没有订阅 Apple Music,因此我这边的 UI 可能与您的不完全相同。但是,如果我单击“播放”按钮,我会收到一个小广告,要求我注册该服务,我认为如果您有该服务,它只会播放音乐。因此,这些是我能够让该框弹出的步骤:
首先,也是最方便的 AppleScript,尝试的事情就是点击空格键开始播放音乐。如果我通过单击手动选择项目,这实际上非常有效。然而,在 open location
之后,它不起作用,这似乎是因为即使该行在查看器中突出显示,实际的键盘焦点似乎在页面本身(iTunes Store和 Apple Music 似乎将其整个 UI 呈现为由 WebKit 呈现的网页)。您可以通过点击键盘上的向上和向下箭头键来验证这一点;页面会上下滚动,而不是切换到相邻的轨道。
我认为这实际上是 iTunes 中的一个错误;我认为问题的真正解决方案是通过 the bug reporter 向 Apple 报告此问题.使用 open location
确实应该将键盘焦点设置到您导航到的轨道上。
话虽如此,我们可以在短期内通过模拟点击“播放”按钮来解决这个问题。请注意,您可能需要在“系统偏好设置”>“安全和隐私”>“辅助功能”中添加您的应用。另请注意,这是非常脆弱的,如果 Apple 更改了他们所服务的网页布局中的任何内容,则整个事情都会崩溃。最后,请注意这段代码非常难看;整个事情只是看着它就让我感到荨麻疹,但这是我唯一能够开始工作的东西。阅读此代码的副作用可能包括恶心、头痛和自杀念头。请勿在进食后立即阅读此代码。如果您有抑郁症或强制症病史,请在阅读此代码之前咨询您的医生。
property trackURL : "itmss://itunes.apple.com/us/album/brahms-violin-concerto-in-d-major-op-77-iii-allegro/145533236?i=145533044&uo=4"
property trackTitle : "III. Allegro giocoso, ma non troppo vivace"
tell application "iTunes"
activate
open location trackURL
delay 1 -- give the page a second to load
end tell
tell application "System Events"
tell process "iTunes"
set theRows to the rows of table 1 of UI element 1 of scroll area 1 of group 1 of group 1 of front window
-- "repeat with eachRow in theRows" isn't working. I don't know why. Freaking AppleScript
repeat with i from 1 to the number of theRows
set eachRow to item i of theRows
if exists group 2 of UI element 2 of eachRow then
if value of static text 1 of group 1 of group 2 of UI element 2 of eachRow is trackTitle then
tell group 1 of UI element 2 of eachRow to click
end if
end if
end repeat
end tell
end tell
当然,如果 Apple 修复了该错误,我们应该能够:
tell application "iTunes"
activate
open location trackURL
delay 1 -- give the page a second to load
end tell
tell application "System Events" to keystroke space
关于Applescript 从 iTunes URL 播放音乐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49647648/
作为桌面开发人员,这对我来说是新的。 如果我能弄清楚这是如何完成的,它可能与我正在做的一些研究有关,特别是如何将厚桌面应用程序迁移到 Web 实现。 我能找到更多面向形式和轻量级的图形,但重量级的 3
我发现我可以搜索这样的歌曲术语: https://itunes.apple.com/search?media=music&entity=musicTrack&attribute=songTerm&te
我最近发布了一个 iPhone 应用程序,但我没有看到任何方法可以像在 Google Play 中一样检查应用程序统计信息。 你能告诉我怎么做吗? 最佳答案 您可以从 iTunes Connect 开
我刚刚发布了一款 iPhone 应用程序并正在更新其支持网站。我使用 iTunes Link Maker 创建了如下所示的链接。有一次,它打开了 iTunes,其余时间都没有。我尝试关闭 iTunes
我们想编写一个 Windows/OS X 应用程序,将播客评级信息从 iPod 和 iTunes 发送回服务器。两个问题: 是否有关于评分数据如何存储在 iTunes 中的文档, 如果用户将 iTun
如何获取可用的 iTunes 播客的 RSS 提要 URL?我想要一个列出 iTunes 上所有播客的提要。这可能吗? 谢谢。 最佳答案 现在有几种选择: iTunes RSS Feed Genera
我已经在 Apple iTunes 上更新了新版本的 iOS 应用程序。今天早上获得批准后,我发布了版本。已经超过 5 小时了,我仍然无法在 iTunes 上看到更新版本。当我打开 URL 时它仍然显
我正在使用 iTunes Store web service search API 获取歌曲信息. 我遇到的唯一问题是艺术品的分辨率极低(只有 60x60px 或 100x100px 可用)。 art
打算使用iTunes Search API来获取与应用程序相关的信息-http://www.apple.com/itunes/affiliates/resources/documentation/it
我很喜欢使用 iTunes Store,但我很好奇它是基于什么开发的(PHP 和 MySQL、Something Custom?)。 最佳答案 WebObjects 。如今它随 XCode 一起提供,
这与这样的帖子有关:iTunes API: get 100x100 px icon of an App 但是,由于接受答案中描述的方法似乎在某些情况下却被打破了,但仍然是一致的,所以我要问是否有已知的
有没有办法以编程方式与 iTunes 交互以添加新的播放列表或智能 View ? 例如,假设我从网站下载了 10 个新的 mp3 文件,有没有办法以编程方式将这个 mp3 列表添加到名为“New Al
使用 iTunes Link Maker 时一个人会得到一个 http-Link,这非常好,因为它也适用于非 iOS 设备。 但是当我在网页上使用它时,重定向到应用程序的确切时间是什么时候? Safa
有没有办法从 3rd 方应用程序以编程方式将 mp3 添加到我的 iTunes 库? 最佳答案 iTunes 有一个文件夹,您可以在其中放置文件,以便自动将其添加到库中。 C:\Users\Your
我已经搜索了如何在文件系统更改时在 iOS5 中接收回调。我从 Apple 的网站上找到了以下示例,但它仅在删除/创建文件时通知给定的委托(delegate)。 DirectoryWatcher cl
在 Cocoa 应用程序中,我正在寻找一种从 iTunes 检索专辑插图的解决方案,而不需要 iTunes 本身在后台启动和运行。 通常也是唯一的解决方案,Scripting Bridge,以及固有的
嗨,我的应用程序有指向 iTunes 音乐专辑的链接 像这样 http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643
我有自己的 iTunes Connect 帐户和 Apple 开发者许可证。 现在我加入了现有的开发人员团队,并希望能够将他们的构建上传到 iTunes Connect。 我通过 developer.
到目前为止我已经尝试过了,但仍然很不走运,我的应用程序没有安装到某些设备上。 这是步骤。 添加了 3 台设备的 UDID(2 X iPhone 5、iPad 4)。 修改后的开发配置文件(使用 * A
我正在尝试从 iTunes 搜索 API 获取播客剧集列表。我可以调用 API 并根据搜索词取回所有播客专辑: https://itunes.apple.com/search?media=podcas
我是一名优秀的程序员,十分优秀!