2018-10-15 ahk定义按键双击效果如何保证其他时候组合键正常运行?

最开始在脚本中定义了lctrl,lalt双击切换输入法:

/*
LAlt::  ; why unable to use in input box by srun
if (A_PriorHotkey <> "LAlt" or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, LAlt
    return
}
;SendInput {Enter}
;gosub NextIME
gosub en
return

LCtrl::  ; why unable to use in input box by srun
if (A_PriorHotkey <> "LCtrl" or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, LCtrl
    return
}
;gosub NextIME
gosub cn
return
*/

使用时发现其他使用ctrl或者alt的组合键无法使用了?!
于是想办法修改上述代码:

~LCtrl::  
if (A_PriorHotkey = "~LCtrl" and A_TimeSincePriorHotkey < 400)
{
gosub cn
}
return
~LAlt::  
if (A_PriorHotkey = "~LAlt" and A_TimeSincePriorHotkey < 400)
{
gosub en
}
return

这样,果然OK了!

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Eclipse常用快捷键 1几个最重要的快捷键 代码助手:Ctrl+Space(简体中文操作系统是Alt+/)快速...
    山不转人自转阅读 5,357评论 0 10
  • 一 Ctrl键功能 1 、Ctrl S保存 2 、Ctrl W关闭程序 3 、Ctrl N新建 4 、Ctrl ...
    鲸故阅读 5,607评论 0 0
  • win10快捷键大全大家可以来了解一下,今天小编带来了win10常用快捷键,很多朋友喜欢使用快捷键来操作电脑,那么...
    宁静消失何如阅读 11,182评论 0 38
  • 1. ctrl+shift+r:打开资源 这可能是所有快捷键组合中最省时间的了。这组快捷键可以让你打开你的工作区中...
    微扬轻轻语阅读 4,241评论 1 7
  • 今天使用快捷键时,突然想整理一下所有的快捷键,希望对大家有帮助: Ctrl+S保存 Ctrl+W关闭程序 ...
    邹小月阅读 3,184评论 0 2