Applescript 从 Safari 获取 URL
我正在尝试从 Safari 获取 URL,关闭选项卡并在 Chrome 中打开它( TUAW Post )但我不断收到错误:
error "Safari got an error: Can’t get current tab." number -1728 from current tab
从代码行:
set theURL to URL of current tab of window 1
有什么建议吗?
全部代码:
property theURL : ""
tell application "Safari"
set t set theURL to URL of current tab of window 1
close current tab
end tell
tell application "Google Chrome"
set URL of active tab of window 1 to theURL
activate
end tell
I'm trying to get the URL from Safari, close the tab and open it in Chrome ( TUAW Post ) But I keep getting the error:
error "Safari got an error: Can’t get current tab." number -1728 from current tab
From the code line:
set theURL to URL of current tab of window 1
Any suggestions?
All the code:
property theURL : ""
tell application "Safari"
set t set theURL to URL of current tab of window 1
close current tab
end tell
tell application "Google Chrome"
set URL of active tab of window 1 to theURL
activate
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它对我有用...
您必须显示更多代码,因为错误是由其他原因引起的。让我问你,你是否在另一个tell 块内有tell application Safari 语句?也许它在告诉谷歌浏览器代码块内?如果是这样,请将其删除。
It works for me...
You have to show more code because the error is caused by something else. Let me ask you this, do you have the tell application Safari statement inside of another tell block? Maybe it's inside the tell google chrome block of code? If so remove it.
非常感谢大家!这是最终的代码。
Thanks a lot guys! Here is the final code.