Keyboard 替换Alt+的左键和右键单击;1和Alt+;2(自动热键)
我想在按住Alt键+1时发送单击,然后在按住Alt键的同时发送右键单击,然后在按住2键时发送右键单击 我的代码Keyboard 替换Alt+的左键和右键单击;1和Alt+;2(自动热键),keyboard,keyboard-shortcuts,autohotkey,Keyboard,Keyboard Shortcuts,Autohotkey,我想在按住Alt键+1时发送单击,然后在按住Alt键的同时发送右键单击,然后在按住2键时发送右键单击 我的代码 !q:: Send {LButton Down} KeyWait q Send {LButton Up} Return !w:: Send {RButton Down} KeyWait w Send {RButton Up} Return 我们的想法是一直按ALT键 例如: !:: { q:: Send {LButton Down} KeyWait q Sen
!q::
Send {LButton Down}
KeyWait q
Send {LButton Up}
Return
!w::
Send {RButton Down}
KeyWait w
Send {RButton Up}
Return
我们的想法是一直按ALT键
例如:
!:: { q::
Send {LButton Down}
KeyWait q
Send {LButton Up}
w::
Send {RButton Down}
KeyWait w
Send {RButton Up}
KeyWait !
Return
}
请帮帮我这就是你要找的吗
!1::Click
!2::Click Right
我测试了一些代码,得出了这个结论。
你应该避免使用alt键,因为(你可以测试它)它会导致右键菜单消失(在桌面上右键单击,没有任何ahk应用程序运行。然后按alt键,你会看到菜单消失。)
所以这里我使用Ctrl键 唯一需要添加的是
$
前缀。下同:
$^1::
send, {lbutton down}
keywait, 1
send, {lbutton up}
return
$^2::
send, {rbutton down}
keywait, 2
send, {rbutton up}
return
它使用Ctrl
键,您不能使用Alt
键,因为它禁用弹出菜单。您可以使用
alt键而不是ctrl键,但您必须先释放alt
,然后释放2
,以防止该菜单消失
我想你想要的是这样的东西。我弄明白了为什么它会重复发送,并处理了它。但它也不起作用。也许alt键是自动结束的(我的意思是它的行为自然是这样的)
另一种解决方案是使用关键点代替修改器:
$1::
if GetKeyState("z", "p") {
send, {lbutton down}
keywait, 1
send, {lbutton up}
}
else {
SetKeyDelay, -1
Send {Blind}{1 DownTemp}
}
return
$1 up::
SetKeyDelay, -1
Send {Blind}{1 Up}
return
$2::
if GetKeyState("z", "p") {
send, {rbutton down}
keywait, 2
send, {rbutton up}
}
else {
SetKeyDelay, -1
Send {Blind}{2 DownTemp}
}
return
$2 up::
SetKeyDelay, -1
Send {Blind}{2 Up}
return
您可以使用任意键代替
“z”
z
类似于alt
键。第二个代码不起作用为什么不用alt+1“启动”脚本,做你的事情,然后等待“just”2(不是alt+2)继续脚本。您可以测试下一个输入,如果它不是一个数字(即您开始做其他事情),则中断脚本。或者,如果你想使用Alt+2,你可以先测试Alt(向下)的键状态?和[hold alt]+[1](send click)并仍然按住alt,按2键以发送click Right:(可能是不可能的,我非常了解,第一个代码工作得很好,如果将“^”替换为“!”不起作用,第二个代码出现问题,无法显示上下文menu@dcaro你喜欢哪个键代替alt?我现在用你的脚本和Win键,我更喜欢按位置Win键或Ctrl键Right@dcaro我添加了一个新的解决方案。您可以使用alt
上方的键(这里实际上是我键盘上的z
)因为它是alt
键。
$1::
if GetKeyState("z", "p") {
send, {lbutton down}
keywait, 1
send, {lbutton up}
}
else {
SetKeyDelay, -1
Send {Blind}{1 DownTemp}
}
return
$1 up::
SetKeyDelay, -1
Send {Blind}{1 Up}
return
$2::
if GetKeyState("z", "p") {
send, {rbutton down}
keywait, 2
send, {rbutton up}
}
else {
SetKeyDelay, -1
Send {Blind}{2 DownTemp}
}
return
$2 up::
SetKeyDelay, -1
Send {Blind}{2 Up}
return