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了!

你可能感兴趣的:(2018-10-15 ahk定义按键双击效果如何保证其他时候组合键正常运行?)