问题描述
我在按键绑定中将LButton(鼠标左键)用作前缀键。我可以正常使用了,问题是我现在需要重新定义LButton,使其处于自然状态...以Autohotkey的术语来说。
我读了这篇文章:https://www.autohotkey.com/docs/commands/GetKeyState.htm.
并附带了以下代码,但是它根本无法按照我认为的方式工作。简而言之,您可以使用$ LButton :: Send {Click Left}来模拟基本的鼠标单击。问题是当您按住按钮/键时,什么也没发生。我以为可以模仿或定义“按下”行为的代码将很容易使用,但是我发现这没有用。
$LButton::
if (GetKeyState("LButton","P"))
Send,{Click Left Down} ;tried variants with {Click Left} etc alrdy
else
Send,{Click Left Up}
return
对于发表评论的人:
LButton & ~RButton::
Send,1{Click Right}{Click Left}{Click Right}{MButton}
Sleep 130 ;125
Send,1
return
$LButton:: ;no idea what this shud be
sendinput {Click Left}
;Send,{Click Left Down}
;KeyWait,LButton
;Send,{Click Left Up}
return
RButton::
Send,1
return
解决方法
不确定我是否理解正确,但是您想按住LButton,然后单击RButton运行此代码:
Send,1{Click Right}{Click Left}{Click Right}{MButton}
Sleep 130 ;125
Send,1
仅单击RButton也应该运行该代码?
如果只是正常按下LButton(而不是与RButton组合使用),它应该能正常工作吗?
好吧,就是这样
~LButton & RButton::
RButton::
Send,1{Click Right}{Click Left}{Click Right}{MButton}
Sleep,130
Send,1
return
基本上只是利用~
modifier。
尽管我不能代表Send,1{Click Right}{Click Left}{Click Right}{MButton}
。
我不知道该怎么办,但也许/希望它做对了。
按w或您定义的内容即可完成工作
w::
Send,{Click down}
Send,{Blind}1{Click Right}{Click}{Click Right}{MButton}
Sleep 130 ;125
Send,1
return
任何寻求类似东西的人都可以朝这个方向尝试
,$filters | foreach { Start-Job -FilePath "$PWD\$_" } | Wait-Job
只需按w即可完成工作
或者
,下面的一个会做
#SingleInstance force
#warn
r::Reload
x::ExitApp
w::
Send,1
return