从获得的Chrome OS X上最前面的选项卡的网址是什么? [英] Get the URL of the frontmost tab from Chrome on OS X?

查看:182
本文介绍了从获得的Chrome OS X上最前面的选项卡的网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法做到这一点Chrome浏览器?

Is there a way to do this to Chrome?

tell application "Google Chrome"
 return URL of front document as string
end tell

...不能正常工作。

... doesn't work.

推荐答案

由于没有AppleScript的支持,这是可以做到的唯一途径是通过GUI脚本,我不知道你是多么熟悉的AppleScript但GUI脚本是一个不好的做法进入。所以借此code慎用。这也是重要您对您的普及preferences启用辅助设备的访问。

Since there is no applescript support the only way it can be done is through GUI scripting, I'm not sure how familiar you are with applescript but gui scripting is a bad practice to get into. so take this code with caution. it is also important that you have access for assistive devices ENABLED in your Universal Access preferences.

  tell application "Google Chrome"
    activate
    tell application "System Events"
        tell application process "Google Chrome"
            get value of text field 1 of tool bar 1 of window 1
        end tell
    end tell
  end tell

这篇关于从获得的Chrome OS X上最前面的选项卡的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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