Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.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
Macos 在OSX中获取重点浏览器选项卡_Macos_Applescript - Fatal编程技术网

Macos 在OSX中获取重点浏览器选项卡

Macos 在OSX中获取重点浏览器选项卡,macos,applescript,Macos,Applescript,我正在尝试从浏览器获取活动浏览器选项卡。我可以通过以下代码为Chrome实现这一点: tell application "Google Chrome" set myURL to the URL of the active tab of the front window end tell 对于Safari,我正在将Chrome更改为Safari,但它根本不起作用 有人帮我吗?对于Safari它是: tell application "Safari" set myURL to th

我正在尝试从浏览器获取活动浏览器选项卡。我可以通过以下代码为Chrome实现这一点:

tell application "Google Chrome"
    set myURL to the URL of the active tab of the front window
end tell
对于Safari,我正在将Chrome更改为Safari,但它根本不起作用


有人帮我吗?

对于Safari它是:

tell application "Safari"
    set myURL to the URL of the current tab of the front window
end tell
您也不需要如此冗长,删除所有出现的
,例如:

set myURL to URL of current tab of front window
做同样的事情

脚本编辑器中,在库中查找Safari

  • 脚本编辑器窗口Safari


这是我试过的答案@用户3439894

Thx-man。。我在发布问题后得到了答案。。我现在分享我自己。如果“Safari”在myBrowser中,则将myBrowser设置为“Safari”,然后告诉应用程序“Safari”以字符串形式返回前面文档的URL,否则如果“Google Chrome”在myBrowser中,则告诉应用程序“Google Chrome”将myBrowser设置为前窗口活动选项卡的URL end tell end If抱歉,我在上一条评论中找不到如何显示l代码布局:(