脚本 Safari 5.1 打开选项卡 [英] Script Safari 5.1 to open a tab
问题描述
可能的重复:
使用 AppleScript 在新的 Safari 标签页中打开 URL
如何告诉 Safari 在当前窗口的新标签页中打开 URL?
How do I tell Safari to open a URL in a new tab of the current window?
这是 使用 AppleScript 在新的 Safari 选项卡中打开 URL 的副本,但是它的答案不再适用于当前版本的 Safari(10.6.8 上的 5.1).该选项卡已创建但为空:
This is a duplicate of Open URL in new Safari tab with AppleScript, however its answer no longer works with the current version of Safari (5.1 on 10.6.8). The tab is created but empty:
tell front window of application "Safari"
make new tab with properties {URL:"http://www.stackoverflow.com"}
end tell
如果您创建一个新的文档",则 URL 会被接受,但这会打开一个窗口.
If you make a new "document" instead the URL is honored, but this opens a window.
无论如何,我已将此作为错误报告给 Apple.但解决方法会很棒.
For what it's worth, I reported this as a bug to Apple. But a workaround would be great.
推荐答案
我这里没有最新的 Safari,但这可能有用
I don't have the latest Safari here, but this might work
tell front window of application "Safari"
set newTab to make new tab
set the URL of newTab to "http://www.stackoverflow.com"
set the current tab to newTab
end tell
这篇关于脚本 Safari 5.1 打开选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!