使⽤AHK减少⿏标和⽅向键的使⽤频率,⾼效编辑
是⼀款热键脚本语⾔,⽹上相关的介绍很多,我这不多介绍。⼀般敲多的码的⼈,对⽅向键、键盘和⿏标之间来回移动都会觉的是⼀件很⿇烦的事,使⽤vim的除外,所以我这在这⾥介绍使autohot实现⿏标与⽅向键的功能。
⼀般来说平时capslock键和scrllLock 这两个键使⽤的频率⾮常低,我们可以将caplock设为和ctl、alt、win⼀样的功能键,但是使⽤capslock这个设置会有出现⼤⼩写切换的问题,使⽤ahk这个软件来换键并不是⼀个好的解决⽅案,所以我还要⽤到另⼀个改键软件KeyTweak。KeyTweakn改键原理是修改注册表,⽐ahk更为彻底,我将caplock和scrllLock相换⼀下,以后⼤⼩切换就是scrllLock了(我平时都是按shift的)。
下⾯开始在ahk中编辑。
⿏标功能
这部分代码来⾃www.ahk8/,年代久远原作者记记是谁了。。
SetScrollLockState, AlwaysOff;禁⽤SetScrollLockState
#SingleInstance
count = 0
JoyMultiplier = 0.20
JoyThreshold = 3
JoyThresholdUpper := 50 + JoyThreshold
JoyThresholdLower := 50 - JoyThreshold
YAxisMultiplier = -1
SetTimer, WatchKeyboard, 10
Hotkey, F1, ButtonLeft ;F1模拟左键
Hotkey, F2, ButtonRight;F2模拟右键
Hotkey, up, empty
Hotkey, down, empty
Hotkey, left, empty
Hotkey, right, empty
Return
ScrollLock & F1::;开启⿏标功能
SetTimer, WatchKeyboard, 10
Hotkey, F1, On
Hotkey, F2, On
Hotkey, up, On
Hotkey, down, On
Hotkey, left, On
Hotkey, right, On
Return
ScrollLock & F2::;关闭⿏标功能
SetTimer, WatchKeyboard, Off
Hotkey, F1, Off
Hotkey, F2, Off
Hotkey, up, Off
Hotkey, down, Off
Hotkey, left, Off
Hotkey, right, Off
Return
empty:
Return
WatchKeyboard:
MouseNeedsToBeMoved := false; Set default.
JoyMultiplier+=0.01
SetFormat, float, 03
up:=GetKeyState("Up","p")
down:=GetKeyState("Down","p")
Left:=GetKeyState("Left","p")
right:=GetKeyState("Right","p")
if(Right)
{
MouseNeedsToBeMoved := true
DeltaX := 10
}
else if(Left)
{
MouseNeedsToBeMoved := true
DeltaX := -10
}
else
DeltaX = 0
if (up)
{
MouseNeedsToBeMoved := true
DeltaY := 10
}
else if (Down)
{
MouseNeedsToBeMoved := true
DeltaY := -10
}
else
DeltaY = 0
if MouseNeedsToBeMoved
{
SetMouseDelay, -1; Makes movement smoother.
MouseMove, DeltaX * JoyMultiplier, DeltaY * JoyMultiplier * YAxisMultiplier, 0, R }
Else
count++
If(count>20){
JoyMultiplier = 0.30
count=0
}
}
return
ButtonLeft:
SetMouseDelay, -1; Makes movement smoother.
MouseClick, left,,, 1, 0, D  ; Hold down the left mouse button.
SetTimer, WaitForLeftButtonUp, 10
return
ButtonRight:
SetMouseDelay, -1; Makes movement smoother.
MouseClick, right,,, 1, 0, D  ; Hold down the right mouse button.
SetTimer, WaitForRightButtonUp, 10
return
WaitForLeftButtonUp:;使⽤⽀持⿏标⼿势
if GetKeyState("F1")
return; The button is still, down, so keep waiting.
; Otherwise, the button has been released.
SetTimer, WaitForLeftButtonUp, off
SetMouseDelay, -1; Makes movement smoother.
MouseClick, left,,, 1, 0, U  ; Release the mouse button.
return
WaitForRightButtonUp:
if GetKeyState("F2")
return; The button is still, down, so keep waiting.
; Otherwise, the button has been released.
SetTimer, WaitForRightButtonUp, off
MouseClick, right,,, 1, 0, U  ; Release the mouse button.
return
;;endmouse
⽅向键与其它光标的功能:
按我的设置上下左右分别为caps+i/j/k/l/j;home,end,delete,pgup,pgdn为caps+h/n/o/[/];
;scroll事件
ScrollLock & [::send,{WheelUp}
ScrollLock & ]::send,{WheelDown}
; move left
ScrollLock & j::
if GetKeyState("LShift", "P")
send, +{Left}
else if GetKeyState("LAlt", "P")
send,^{left}
else
send, {Left}
Return
;
move right
ScrollLock & l::
if GetKeyState("LShift", "P")
send, +{right}
else if GetKeyState("LAlt", "P")
send,^{right}
else
send, {right}
Return
mousemove是什么键; move up
ScrollLock & i::
if GetKeyState("LShift", "P")
send, +{up}
else if GetKeyState("LAlt", "P")
send,^!{up}
else if GetKeyState("LControl", "P")
send,^+{up}
else
send, {up}
Return
; move down
ScrollLock & k::
if GetKeyState("LShift", "P")
send, +{down}
else if GetKeyState("LAlt", "P")
send,^!{down}
else if GetKeyState("LControl", "P")
send,^+{down}
else
send, {down}
Return
;home
ScrollLock & h::
if GetKeyState("LShift", "P")
send, +{home}
else
send, {home}
Return
; end
ScrollLock & n::
if GetKeyState("LShift", "P")
send, +{end}
else
send, {end}
Return
;delelte
ScrollLock & o::send,{delete}
拾⾊器
利⽤ahk设置的拾⾊器⾮常⽅便,这⾥设置的快揵是alt+win+c
!#c::
MouseGetPos, mouseX, mouseY
PixelGetColor, color, %mouseX%, %mouseY%, RGB
StringRight color,color,6
clipboard = #%color%
tooltip,color is %color%
sleep 2000
tooltip,
return
剪切板
系统⾃带的剪切板只能⼀起复制与粘贴,下⾯的剪切板⽀持最多30次copy,热键如下:
1. ;win+0:清空 ;
2. ctrl+c:复制 ;
3. win+v:依次粘贴 ;
4. win+]:依次粘贴,但顺序相反
handleClip(action)
{
global static AddNextNum
global static GetNextNum
global static HighestNum
global static getprevnum
global static highest1
global static ClipArray
global static ClipArray1
global static ClipArray2
global static ClipArray3
global static ClipArray4
global static ClipArray5
global static ClipArray6
global static ClipArray7
global static ClipArray8
global static ClipArray9
global static ClipArray10
global static ClipArray11
global static ClipArray12
global static ClipArray13
global static ClipArray14
global static ClipArray15
global static ClipArray16
global static ClipArray17
global static ClipArray18
global static ClipArray19
global static ClipArray20
global static ClipArray21
global static ClipArray22
global static ClipArray23
global static ClipArray24
global static ClipArray25
global static ClipArray26
global static ClipArray27
global static ClipArray28
global static ClipArray29
global static ClipArray30
if (action = "save")
{
if (AddNextNum < 30)
{

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。