0

我正在寻找一种方法来设置键盘快捷键以转到我当时在 Chrome 中浏览的网站的当前主页。

例如,我现在在“ https://stackoverflow.com/questions/ask?wizard=1 ”上。“按下快捷方式”网址“ https://stackoverflow.com/ ”加载。

可能是 chrome 插件或 Alfred 工作流程。

4

1 回答 1

0

您可以创建 Alfred 工作流程并将热键触发器连接到Run NSAppleScript操作,将以下代码添加到后者:

on alfred_script(q)
    tell application "Google Chrome"
        set theURL to URL of active tab of window 1
        set AppleScript's text item delimiters to "/"
        set theHomeURL to text item 1 of theURL & "//" & text item 3 of theURL
        set URL of active tab of window 1 to theHomeURL
        activate
    end tell
end alfred_script

不要忘记为触发器设置热键组合。

于 2019-02-18T18:41:49.857 回答