Thursday, November 20, 2008

AHK - Mouse Wrap-around

Just a little code that will cause the mouse to wrap around to the other side of the screen when it gets all the way to one side.
#Persistent
CoordMode, Mouse, Screen
SysGet, Mon, Monitor
SetTimer, CheckMouse, 10
Return

CheckMouse:
If (!GetKeyState("LButton"))
Return
MouseGetPos, X, Y
If (X <= MonLeft)
MouseMove, % MonRight - 5, %Y%, 0
Else If (X >= MonRight - 1)
MouseMove, % MonLeft + 5, %Y%, 0
Else If (Y <= MonTop)
MouseMove, %X%, % MonBottom + 5, 0
Else If (Y >= MonBottom - 1)
MouseMove, %X%, % MonTop - 5, 0
Return

No comments: