autohotkey - 执行 winkey 后任何可能的热键组合的任务
问题描述
我希望以 LWin 开头的任何可能的键序列来执行特定任务,例如:
LWin & a::
;Execute the task
或者:
LWin & b::
;Execute the task
等等...
当然,对于所有键盘键,写这个是不可能的,所以我想到了这样的东西:
LWin & *:: ; * = KEY
KEY = %A_ThisHotkey% ; KEY is now = LWin & a (for example)
KEY := RegExReplace(Clipboard,"i)^lwIN & ") ; KEY is now = a
; The task that needs to be executed:
Send {LWin UP}
Send {%KEY% DOWN}
KeyWait %KEY%
Send {%KEY% up}
return
但问题是,不能这样使用通配符。如何做到这一点?
解决方案
*LWin::
Input, key, L1
if (ErrorLevel = "NewInput")
Send, {LWin} ; LWin was pressed alone: pass-thru
else if (IsLabel(key))
Goto, % key
else
Send, % "#" key ; pass-thru
return
*LWin UP::Input ; stop listening for secondary key
; Tasks defined here
s:
MsgBox, "s" task launched!
return
p:
MsgBox, "p" task launched!
return
推荐阅读
- node.js - Discord.js 如何使用 sqlite 快速发送消息作者
- flutter - 通过映射到多个键创建小部件列表
- android - 如果文本太长,则使用 wrap_content 行为和省略号
- python - 如何使用 'predict_proba' 获得 AUC 的置信区间?
- android - Android导航组件:通过特定索引弹出回栈的自循环目的地
- c# - 尝试匹配像素颜色然后单击 [C#]
- javascript - 如何使用 webpack 4 将 sass 编译为 css?
- unity3d - 如何使四边形彼此齐平
- javascript - 实例方法不适用于 Sequelize 4
- r - UseMethod(“xgboost”)中的错误:没有适用于“xgboost”的方法应用于“list”类的对象