[英]; as a new modifier key
我要;
成为一个新的修饰键。 以下工作几乎完美。
`;::
if GetKeyState("LShift", "P")
Send `:
else
Send `;
return
`; & x::
if GetKeyState("LShift", "P")
...
else
...
return
以下愿望清单中只有第 2 点不起作用。 有人知道如何修复此代码吗?
;
成为;
单独按下时shift;
to be :
当单独按下时;
x
是第二个...
shift
;
x
是第一个...
在我看来,有两种可能的方法可以使第 2 点起作用。
方法一:保持左Shift键的默认行为
移位+ ; 结果:冒号键被按下。 您可以通过在`;之前添加波浪号“~”键来使第 2 点起作用并删除
else
send `;
使用 ~ 您可以保持密钥的默认行为。 新脚本看起来像这样
~`;::
if GetKeyState("LShift", "P")
Send `:
return
`; & x::
if GetKeyState("LShift", "P")
...
else
...
return
通过使用此方法脚本将能够发送: with shift+; .
方法二:去掉左Shift键的默认行为
在您的代码中添加以下代码段
LShift::
Send, {}
return
此代码段将使第 2 点起作用,但会使左 Shift键对其他所有内容几乎无用。
编辑
方法三:制作;
等待x
将KeyWait
添加到脚本中会使其在执行代码之前等待一定的时间。 其次使用Lshift
+ ;
作为单独的热键组合,将 output 转换为:
,无需使用~
作为回报。
`;::
KeyWait, `;, T0.2
Send `;
return
LShift & `;::
Send `:
return
`; & x::
KeyWait, `;, T0.2
if GetKeyState("LShift", "P")
...
else
...
return
以下工作完美,但由于代码重复而代码难看。 也许更简洁的代码是可能的。
started := 0
LShift & `;::
if started = 0
started := A_TickCount
return
`;::
if started = 0
started := A_TickCount
return
LShift & `; Up::
if A_TickCount - started < 500
Send `:
started = 0
return
`; Up::
if A_TickCount - started < 500
Send `;
started = 0
return
`; & x::
started = 0 ; <==== !
if GetKeyState("LShift", "P")
...
else
...
return
关键;
现在,只要它与x
组合使用(无延迟)或按下超过半秒,就可以用作修饰键。 延迟不是必须的,可以消除; 它只是在那里防止将意外的修饰键误解为;
. 冒号:
也可以正常工作。
#MaxThreadsPerHotkey 2 ; allow 2 "instances" of the hotkey subroutine to exist simultaneously
`;::
If (A_PriorKey = "`;") ; ; was pressed alone
Send `;
return
LShift & `;:: Send :
`; & x::
if GetKeyState("LShift", "P") ; ; & LShift & x
Send a
else ; ; & x
Send b
return
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.