Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Author : Zugbug
- ;version : 0.9.6
- ;licence : do-whatever-you-wanna-do
- ;
- ;This autohotkey script is designed to
- ;make mice without a scroll wheel easier
- ;to use. When finished, it will allow you
- ;to use left & right mouse buttons as
- ;a scrolling feature, something that you'd
- ;see on a laptop where you can tap both
- ;buttons for a middle button click, or
- ;hold them and move the mouse to scroll.
- ;This script was inspired by the fact
- ;that my Trackman Marble worked better
- ;on Linux rather than Windows and that
- ;I couldn't find one other single solution
- ;to do this for me.
- ;
- ;I wanna finish by adding a few keywords so
- ;that some other poor sod doesn't have to
- ;scour the internet like I had to.
- ;
- ;keywords : Trackman, Marble, scroll, buttons,
- ;script, two, left+right, middle, autoscroll,
- ;laptop like, hold to scroll, feel free to
- ;share and add
- ;
- CoordMode, Mouse, Screen
- #Persistent
- #SingleInstance force
- ; TODO Detect the longevity of the keystroke to determine whether to send
- ; TODO a MButton or to go into the Update Subroutine
- ; TODO Also, put back in the part which monitored the amount of movement
- ; TODO in the form of change from X to MovedX
- RButton & LButton::
- SetTimer, Update, 10
- MouseGetPos, origX, origY
- MouseGetPos, X, Y
- While (GetKeyState("LButton","P") && GetKeyState("RButton","P"))
- {
- MState := True
- Sleep, 10
- }
- MState := False
- return
- RButton::Send {RButton}
- ; TODO
- Update:
- MouseGetPos, X, Y
- ;SetTimer, waitForMove, 25
- If (OldX <> X || OldY <> Y)
- {
- MovedX := ((OldX - X) > 0) ? (OldX - X) : -(OldX - X)
- ; msgbox, %MovedX%
- MovedY := ((OldY - Y) > 0) ? (OldY - Y) : -(OldY - Y)
- ; msgbox, %MovedY%
- If (OldX < X) && (MovedX > MovedY) && (MovedX > 1)
- Direction = Side
- If (OldX > X) && (MovedX > MovedY) && (MovedX > 1)
- Direction = Side
- If (OldY < Y) && (MovedX < MovedY) && (MovedY > 1)
- Direction = South
- If (OldY > Y) && (MovedX < MovedY) && (MovedY > 1)
- Direction = North
- If ((GetKeyState("LButton","P") && GetKeyState("RButton","P")) && Direction)
- GoSub, %Direction%
- }
- MouseGetPos, OldX, OldY
- Return
- waitForMove:
- msgbox, test
- return
- ;TODO Set up the function to move the mouse back to the original coords. Try
- ;TODO MouseMove on line 38ish
- South:
- Sleep, 1
- MouseMove, origX, origY+5
- Send {WheelDown}
- return
- North:
- Sleep, 1
- MouseMove, origX, origY-5
- Send {WheelUp}
- return
- Side:
- Sleep, 1
- MouseMove, origX, origY
- return
Add Comment
Please, Sign In to add comment