培训电脑每一次打开都会重置,改代码个人常用参考,做个笔记,每次百度关键词打开复制即可
【AHK下载】
【AHK手册】
;========调试========
^!#q::
+#q::
!#q::
^#q::
#q::
send ^s
Sleep 1000
Reload
send {alt up}
send {shift up}
send {ctrl up}
return
;========常用修改========
!`:: send {Asc 096}
`::
send {backspace}
return
capslock::
send {enter}
return
;========窗口移动大小========
mbutton::
ToolTip,
;设置鼠标坐标模式为相对屏幕
CoordMode, Mouse, Screen
MouseGetPos, mX0, mY0 , hwnd
IfWinExist, ahk_id %hwnd%
{
;获取初始窗口位置
WinGetPos, wX0, wY0
WinActivate, ahk_id %hwnd%
}
Else
Return
Loop{
;GetKeyState, state, LAlt, P
;if state = U
;{
; ToolTip
; break
;}
GetKeyState, mState, mbutton, P
if mState = U
{
ToolTip
break
}
;获取当前鼠标位置
MouseGetPos, mX, mY
SetWinDelay, -1
WinMove, ahk_id %hwnd%, , wX0+mX-mX0, wY0+mY-mY0
}
Return
;========================================================
~lbutton & rbutton::
setWinDelay,0
CoordMode,mouse,Screen
MouseGetPos,mx1,my1
WinGetPos,winx,winy,winw,winh,A
loop{
;GetKeyState,vstate,LAlt,p
GetKeyState,vstate,rbutton,p
if vstate=U
break
MouseGetPos,mx2,my2
xx=% winw + mx2 - mx1
yy=% winh + my2 - my1
winmove,A,,%winx%,%winy%,%xx%,%yy%
sleep,30
}
Return
;========================================================
~rbutton:: ;右键八向手势
FinalDirection :=Gesture:=Directions:=LastDirection:=""
MouseGetPos, X, Y
While GetKeyState("rbutton", "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 {rbutton}
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 ↖左上
send {esc}
return
↗:
;MsgBox ↗右上 最大化
WinGet,S,MinMax,A
if S=0
WinMaximize,A
else if S=1
WinRestore,A
else if S=-1
WinMaximize,A
return
↙:
;MsgBox ↙左下 最小化
WinMinimize, A
return
↘:
MsgBox ↘右下
return
R:
send !{right}
return
L:
send !{left}
return
U:
MsgBox, 0, ,↑上 复制, 0.5
send ^c
return
D:
;MsgBox ↓下
send ^v
return
【Snipaste】官网:https://zh.snipaste.com/
https://assets.sayori.moe/snipaste-dl/archives/Snipaste-1.16.2-x64.zip
【Mouselnc】