我在用rb-appscript。下面的行在狮子中很好,但在山狮中却不起作用:
desktop_bounds = Appscript.app.by_name("Finder").desktop.window.bounds.get我有两个问题:
发布于 2012-09-17 07:04:26
这仅仅是我的两分钱:作为替代的MacRuby更多的是Ruby,但比replacement更少Appscript。但它应该能完成任务。
发布于 2012-10-08 16:44:00
我认为这与iTunes 10.6.3中出现的问题相同:关于iTunes的讨论,请参阅这里 (还有一个链接,指向德朗博士发布的appscript的未来的更全面的辩论)和Matt的修复。
问题似乎是appscript无法再为应用程序(在本例中是Finder)获取字典,因此任何对特定于应用程序的方法的调用都会中断。Matt在https://github.com/mattneub/appscript/tree/master/rb-appscript上发布了一个脚本,提供了一种获取字典的替代方法。您可以使用以下方式恢复功能:
require 'Appscript'
$RUBY_DIR = '/Users/ben/Documents/Code/rb-appscript'
def app_module( id )
require "#{$RUBY_DIR}/sdefToRBAppscriptModule.rb"
f = FindApp.by_id(id)
return SDEFParser.makeModule(f)
end
finder = Appscript.app("Finder", app_module('com.apple.finder'))
desktop_bounds = finder.desktop.window.bounds.get
p desktop_boundshttps://stackoverflow.com/questions/12453412
复制相似问题