iTunes 10.6.3 changes AppleScript interface?

我的未来我决定 提交于 2019-12-04 14:56:37

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/

Probably will start happening much more (if not with everything) as of Mountain Lion

I have provided a fix for this issue here:

https://github.com/mattneub/appscript/tree/master/rb-appscript

Yeah, they definitely broke it. You COULD use rb-appscript with the System Events application to conditionally check the children of various UI elements to see if the 'selected' attribute is true.... e.g.:

i = 0
row_exists = true
selected_row = nil
while row_exists && !selected_row
    i += 1
    row_exists = app("System Events").application_processes["iTunes"].windows["iTunes"].scroll_areas[3].outlines[1].rows[i].exists
    if row_exists 
        if (app("System Events").application_processes["iTunes"].windows["iTunes"].scroll_areas[3].outlines[1].rows[i].attributes["AXSelected"].value.get == true)
            selected_row = app("System Events").application_processes["iTunes"].windows["iTunes"].scroll_areas[3].outlines[1].rows[i]
        end
    end 
end

You could then pull out required information from the children of the selected row. This is would be a pretty annoying way to go about this, though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!