Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently got a trackball that does not have a scroll option. I don't know if this is possible but is there a way to detect if the trackball is being moved while a key is being pressed (lets say the alt key), stop the mouse from moving and scroll according to the direction of the trackball?

I found a way to detect a change in the cursor position but not a change in the mouse position. I also did not find a way to stop the cursor from moving.

Can you help?

share|improve this question
Could you post what you already have? – Elliot DeNolf Oct 24 '12 at 20:57
Since I don't know all of the commands necessary I just have some pseudocode. – Daniel Oct 25 '12 at 15:26
up vote 4 down vote accepted

I found this on the AutoHotkey forums and modified it to include horizontal scrolling. Holding down alt and moving the mouse will perform a scroll in the direction of the mouse movement.

       If !GetKeyState("Alt","P")
       MouseGetPos, ax,ay
       Sleep, 50
       Send % (ay<by ? "{WheelDown " : "{WheelUp ") . round(Abs(ay-by)/(GetKeyState("Shift","P") ? 10 : 1)) . "}"
       Send % (ax<bx ? "{WheelRight " : "{WheelLeft ") . round(Abs(ax-bx)/(GetKeyState("Shift","P") ? 10 : 1)) . "}"


share|improve this answer
Thanks for the great answer. – Daniel Oct 26 '12 at 5:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.