问题描述
我有一个简单的 Ruby 脚本,它使用 rb-appscript gem 来控制 iTunes,现在我已经更新到 iTunes 10.6.3,它似乎坏了.
I have a simple Ruby script that uses the rb-appscript gem to control iTunes, and now that I've updated to iTunes 10.6.3, it appears to be broken.
在 10.6.3 之前,这段代码将按预期工作以获取当前选择的曲目:
Prior to 10.6.3, this piece of code would work as expected to get the currently selected track(s):
Appscript.app('iTunes').selection.get()
现在它产生以下错误:
RuntimeError: Unknown property, element or command: 'selection'
刚刚确认这在 py-appscript 中也已损坏,因此它与 rb-appscript 无关.
这很奇怪,因为以下实际的 AppleScript 仍然有效:
Which is weird, because the following piece of actual AppleScript still works:
tell application "iTunes" to get selection
类似的例子,例如 Appscript.app('Finder').desktop.files.get()
仍然有效.
Similar examples such as Appscript.app('Finder').desktop.files.get()
still work.
我找不到任何信息来解释是否或为什么更改了此项,或者我可以做些什么来更新我的脚本.我猜这与 Mountain Lion 的变化有关.
I couldn't find any information that would explain if or why this was changed or what I could do to update my script. I'm guessing it has something to do with Mountain Lion changes.
推荐答案
看起来 iTunes 10.6.3 与 Mountain Lion 附带的沙盒一起发布.这是一篇谈论它的文章(也请阅读评论)http://www.leancrew.com/all-this/2012/06/the-first-nail-in-the-coffin-of-python-appscript/一个>
Looks like iTunes 10.6.3 was release with the sandboxing that is coming with Mountain Lion. Here is an article talking about it (read the comments, too) http://www.leancrew.com/all-this/2012/06/the-first-nail-in-the-coffin-of-python-appscript/
从 Mountain Lion 开始,可能会发生更多(如果不是全部)
Probably will start happening much more (if not with everything) as of Mountain Lion
这篇关于iTunes 10.6.3 更改 AppleScript 界面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!