我无法让rb-appscript激活特定的Safari窗口。它总是激活最近活动的窗口。
(在irb中,假设rb-appscript已经安装)
require 'appscript'
include Appscript
safari = app 'Safari'
safari.open_location "http://www.google.com"
safari.open_location "http://www.apple.com"
safari.open_location "http://www.bing.com"
safari.documents.URL.get
=> ["http://www.bing.com/", "http://www.apple.com/", "http://www.google.com.ph/", "http://www.apple.com/startpage/"]
safari.documents[1].URL.get
=> "http://www.bing.com/"
safari.documents[3].URL.get
=> "http://www.google.com.ph/"现在是毛发的部分了。激活documents3应该会激活谷歌窗口,但实际情况并非如此。
safari.documents[3].activate
=> nil (activates the bing window instead of the google window)
safari.windows[3].activate
=> nil (activates the bing window instead of the google window)发布于 2011-07-13 20:41:24
你不能activate窗口:
app("Safari").windows[its.name.eq("Google")].index.set(1)tell application "Safari" to set index of (windows where name is "Google") to 1https://stackoverflow.com/questions/6678899
复制相似问题