Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome Applescript从Safari获取URL_Google Chrome_Safari_Applescript - Fatal编程技术网

Google chrome Applescript从Safari获取URL

Google chrome Applescript从Safari获取URL,google-chrome,safari,applescript,Google Chrome,Safari,Applescript,我正在尝试从Safari获取URL,关闭选项卡并在Chrome()中打开它,但我一直收到错误: 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" s

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

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

您必须显示更多代码,因为错误是由其他原因引起的。让我问一下,在另一个tell块中是否有tell-application-Safari语句?也许它在告诉谷歌chrome的代码块里面?如果是这样,请将其移除。

非常感谢各位!这是最后的代码

property theURL : ""

tell application "Safari"

    set theURL to URL of current tab of window 1

end tell

tell application "Google Chrome"

    tell window 1
        make new tab with properties {URL:theURL}
    end tell

    activate

end tell

属性URL:“告诉应用程序”Safari“将URL设置为前面文档的URL作为字符串关闭当前选项卡结束告诉应用程序”Google Chrome“将窗口1的活动选项卡的URL设置为URL激活结束告诉”
确定,现在我看到您的错误。在“关闭”行中。就这样吧。。。关闭窗口1.Sry的当前选项卡。不是这样。“error”Safari出现错误:无法获取窗口1的URL。“number-1728 from-URL from-window 1”您的Safari窗口是否全屏?不记得了。但是我的问题的解决方案被贴在了页面的下方,但是给你带来麻烦的代码行在解决方案中没有改变。我认为这是一个零星的错误,只有当Safari全屏显示时才会发生。