【AHK】个人自用代码/出差临时电脑专用/培训电脑用/AHK手册(不断更新ing...)

培训电脑每一次打开都会重置,改代码个人常用参考,做个笔记,每次百度关键词打开复制即可

【AHK下载】

【AHK手册】

常用AHK代码




;========调试========
!^+#q::
^!#q::
^+#q::
!+#q::
+#q::
!#q::
^#q::
#q::
send ^s
Sleep 1000
Reload

send {alt up}
send {shift up}
send {ctrl up}
send {win 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】

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值