回答 #1
这是皮耶罗再次回一个新的 id (我失去了我的 cookie 尝试重新安装火狐时!!!)。
我只被试图火狐 304 什么改变有关 appleScript 支持和 relyability。仍是相同的 bug...
我的测试和登陆的网站,搜索带我到你不能访问窗口的名称和其他属性的窗口,例如 «类卷曲»,在同一脚本中的结论。
如果您正在使用的名称窗口,以及,suddently,您不能访问它不再 (以获取随机二进制字符串一样),您必须再次调用此代码:
tell application "Firefox" to activate
使用任何将在火狐中生成错误的语句还将努力就好,使窗口名称再次,可用,但重新启动你的 Mac 不会改变任何东西 !
一旦你已经做了,正如我前面提到,您不能访问 «类卷曲» 不再,直到下一个 Firefox 重新启动...
在 Mac 上的火狐编写脚本真的是使命是不可能的 !
如果您想 AppleScript 要支持 Firefox 上告诉它,和这个 bug 投票支持 !!!
https://bugzilla.mozilla.org/show_bug.cgi?id=464701
回答 #2
激活用户界面的脚本,然后运行下面的代码。你会有该 URL 在剪贴板中,您可以将其粘贴。
tell application "Firefox" to activate
tell application "System Events"
keystroke "l" using command down
keystroke "c" using command down
end tell
回答 #3
Google Chrome 的 Mac 已添加的 AppleScripting 方法,用于获取 URL。
这里是铬 AppleScript SDK
https://sites.google.com/a/chromium.org/dev/developers/design-documents/applescript
从下面链接的页面的示例:
tell application "Google Chrome"
get URL of active tab of window 1
end tell
在这里更多例子:
http://laclefyoshi.blogspot.com/2010/10/google-chrome-ver.html
回答 #4
火狐 3.03,将隐藏从 AppleScript 所有的窗口属性,包括 «类卷曲»,如果您使用的语句将类似于以下之前的当前有一个 bug:
tell application "Firefox" to activate
或
tell application "Firefox"
if (front window) exists then do_something()
end tell
变通办法是,而是使用下面的代码:
tell application "System Events"
tell process "Firefox"
set frontmost to true
set xsist to (front window) exists
(* keep xsist value to test later on *)
end tell
end tell
注:窗口的属性将继续直至下一步重建香港经济活力的 Firefox,在国际间不可用
回答 #5
卡米诺 1.6 及以上:
tell application "Camino"
return URL of current tab of front browser window as text
end tell
与早前的答复中,不同的是这将得到聚焦选项卡的 URL。
回答 #6
火狐 (2.0.0.14 和 3.0.1 版上测试):
tell application "Firefox"
set myURL to «class curl» of window 1
return myURL
end tell
回答 #7
卡米诺 (测试版本 1.6.4):
tell application "Camino"
set p to properties of front tab of front window
return |currentURI| of p as string
end tell
回答 #8
OmniWeb (测试版 5.8 上):
tell application "OmniWeb"
set myInfo to GetWindowInfo
return item 1 of myInfo
end tell
回答 #9
歌剧 (9.21 和 9.62 版本上进行测试):
tell application "Opera"
return URL of front document as string
end tell
回答 #10
羊群 (在 2.0 版上测试):
tell application "Flock"
set p to properties of front window as list
return item 3 of p
end tell
这依赖于该列表项的位置,但据我所知,这是唯一能到达此值。该财产命名为 address
,尽管苹果公司的文档没有这么说,似乎是 AppleScript 中的保留的字。