鼠标手势已经可以实现很多功能,但还是有一些不常用/误触的键位设置,已经不知道用什么手势代替了,毕竟手势如果超过三笔就不便捷也不好记忆,所以,中键手势在我的鼠标本身就较难适应,那么就很适合配合简单的中键手势实现一些不怎么常用的设置
~mbutton:: ;中键手势
FinalDirection :=Gesture:=Directions:=LastDirection:=""
MouseGetPos, X, Y
While GetKeyState("mbutton", "P")
{
Sleep, 10
MouseGetPos, 1X, 1Y
Distance := Sqrt((1X-X)**2+(1Y-Y)**2)
RegExMatch(Gesture, "\w+$", LastAddedDirection)
If (Distance>=20)
Direction := G(1X-X, 1Y-Y)
If (Distance>=20)
FinalDirection := G(1X-X, 1Y-Y)
If (Direction=FinalDirection && Direction<>LastAddedDirection && Distance>=5)
{
Directions .= (Gesture ? "-" : "") Direction
Gesture := Directions
}
If (Direction<>LastDirection || Distance>=5)
X := 1X , Y := 1Y
LastDirection := Direction
}
StringLeft, O, Gesture, 1
IF O
Gosub %O%
else
SendInput {mbutton}
Return
G(X_, Y_)
{
Argument := ACos(X_/Sqrt((X_**2)+(Y_**2)))*(45/ATan(1))
Argument := Y_<0 ? Argument : 360-Argument
Return, ["R" , "↗" , "U", "↖" , "L" , "↙" , "D" , "↘" , "R"][Ceil((Argument-22.5)/45)+1]
}
↖:
MsgBox ↖左上
return
↗:
MsgBox ↗右上
return
↙:
MsgBox ↙左下
return
↘:
MsgBox ↘右下
return
R:
; MsgBox 鼠标删除
send {delete}
return
L:
; MsgBox 鼠标退格
send {backspace}
return
U:
; MsgBox 全局暂停
send ^!p
return
D:
; MsgBox 唤醒music
send ^#w
return