Macos 在OSX中获取重点浏览器选项卡
我正在尝试从浏览器获取活动浏览器选项卡。我可以通过以下代码为Chrome实现这一点: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
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
这是我试过的答案@用户3439894Thx-man。。我在发布问题后得到了答案。。我现在分享我自己。如果“Safari”在myBrowser中,则将myBrowser设置为“Safari”,然后告诉应用程序“Safari”以字符串形式返回前面文档的URL,否则如果“Google Chrome”在myBrowser中,则告诉应用程序“Google Chrome”将myBrowser设置为前窗口活动选项卡的URL end tell end If抱歉,我在上一条评论中找不到如何显示l代码布局:(