【问题标题】:Chrome shortcut via AHK to reopen last page visited通过 AHK 的 Chrome 快捷方式重新打开最后访问的页面
【发布时间】:2014-09-09 23:30:19
【问题描述】:

允许 Chrome 打开上次访问的网页的 ahk 脚本是什么?我不是要求重新打开关闭的标签页,这在 Chrome 上很容易,我要求一个快捷方式来打开我重新打开 Chrome 时访问的最后一个页面,而不是将 Chrome 设置为默认设置。

【问题讨论】:

  • CTRL + H\tab \tab \tab \tab Enter
  • @darka 最后一个“Enter”没有打开那个链接,这会是什么方法?我快到了:我的意思是突出显示正确的链接

标签: google-chrome keyboard-shortcuts autohotkey


【解决方案1】:

这是基于 Darka 评论的 AutoHotkey 脚本:

版本 1:

SetTitleMatchMode, 2
WinActivate, Google Chrome

CheckChromeWindow:
IfWinActive, Google Chrome
{
    Send, ^h
}
else
{
    Goto, CheckChromeWindow
}

CheckHistoryPage:
IfWinActive, History - Google Chrome
{
    Send, {Tab 4}
    Send, {Enter}
}
else
{
    Goto, CheckHistoryPage
}




编辑:
第 2 版:

SetTitleMatchMode, 2
WinActivate, Google Chrome

CheckChromeWindow:
IfWinActive, Google Chrome
{
    Send, ^h
}
else
{
    Goto, CheckChromeWindow
}

CheckHistoryPage:
IfWinActive, History - Google Chrome
{
    Send, {Tab 5}
    Send, {Enter}
}
else
{
    Goto, CheckHistoryPage
}



第 3 版:

SetTitleMatchMode, 2
WinActivate, Google Chrome

CheckChromeWindow:
IfWinActive, Google Chrome
{
    Send, ^h
}
else
{
    Goto, CheckChromeWindow
}

CheckHistoryPage:
IfWinActive, History - Google Chrome
{
    Send, {Tab 4}
    Send, {Enter}
    Send, {Tab}
    Send, {Enter}
}
else
{
    Goto, CheckHistoryPage
}




如果您想使用热键运行该代码(在我们的例子中是 CTRL+Alt+z)然后将上面的代码放在 ;some code 的位置在 pu 所有代码放在脚本末尾之后:

return
!^z::
    ;some code
return




另外,请始终使用来自 http://ahkscript.org/ 的 AutoHotkey 及其文档(当前最新版本,新官网)! AutoHotkey 及其来自 autohotkey.com 的文档已过时,您在使用它们时可能会遇到一些问题!

【讨论】:

  • 它不起作用:#IfWinActive ahk_class Chrome_WidgetWin_1 ^!s:: SetTitleMatchMode, 2 WinActivate, Google Chrome Send, ^h CheckHistoryPage: IfWinActive, History - Google Chrome { Send, {Tab 4} Send, {Enter} } else { Goto, CheckHistoryPage } Return #IfWinActive
  • @AMDG 请为您的代码使用类似 Pastbin 的服务。哪个代码不适合您、我的或您的?您使用的是哪个版本的 AutoHotkey?
  • 是你的代码不起作用。所以我试图引用我的脚本,但很抱歉我无法制作代码块。 ahk 版本为 v1.1.09.04
  • @AMDG 您是否在没有任何其他代码的情况下尝试了我的代码?因为至少那个代码不是我的#IfWinActive ahk_class Chrome_WidgetWin_1 ^!s::
  • 嗯,是的,我只是更改了代码应该在 Chrome 和热键的上下文中运行。其余的都是一样的,虽然我不知道如何创建代码块,但我在此评论中粘贴了。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多