Applescript 从 Safari 获取 URL [英] Applescript to get the URL from Safari

查看:25
本文介绍了Applescript 从 Safari 获取 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Safari 获取 URL,关闭选项卡并在 Chrome 中打开它( TUAW Post ) 但我不断收到错误:

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

来自代码行:

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

推荐答案

它对我有用...

tell application "Safari"
    set theURL to URL of current tab of window 1
end tell

您必须显示更多代码,因为错误是由其他原因引起的.让我问你这个,你有另一个告诉块内的告诉应用程序Safari语句吗?也许它在告诉谷歌浏览器的代码块中?如果是这样,请将其删除.

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.

这篇关于Applescript 从 Safari 获取 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆