Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for a way to scroll with the keyboard using AutoHotkey. It would be also great if I could tweak scrolling speed somehow.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

You can use the MouseClick function to simulate the mouse wheel. Here's an example script that lets you scroll by holding down the CapsLock key and pressing 'w' to scroll up or 's' to scroll down:

CapsLock & w::
 MouseClick,WheelUp,,,10,0,D,R
return

CapsLock & s::
 MouseClick,WheelDown,,,10,0,D,R
return

You can make it go faster by changing the 10 to a larger value. It is the number of "detents" you want the wheel to scroll through.

There is also a script at autohotkey.com that sets up all the mouse buttons and movements on the NumPad, though I've not tried it.

share|improve this answer

Mouse Wheel Hotkeys [Windows NT/2000/XP or later]

Hotkeys that fire upon turning the mouse wheel are supported via the key names WheelDown and WheelUp. WheelLeft and WheelRight are also supported in v1.0.48+, but have no effect on operating systems older than Windows Vista. Here are some examples of mouse wheel hotkeys:

MButton & WheelDown::MsgBox You turned the mouse wheel down while holding down the middle button.
^!WheelUp::MsgBox You rotated the wheel up while holding down Control+Alt.

In v1.0.43.03+, the built-in variable A_EventInfo contains the amount by which the wheel was turned, which is typically 1. However, A_EventInfo can be greater or less than 1 under the following circumstances:

  • If the mouse hardware reports distances of less than one notch, A_EventInfo may contain 0;
  • If the wheel is being turned quickly (depending on type of mouse), A_EventInfo may be greater than 1. A hotkey like the following can help analyze your mouse: ~WheelDown::ToolTip %A_EventInfo%

Some of the most useful hotkeys for the mouse wheel involve alternate modes of scrolling a window's text. For example, the following pair of hotkeys scrolls horizontally instead of vertically when you turn the wheel while holding down the left Control key:

~LControl & WheelUp::  ; Scroll left.  
ControlGetFocus, fcontrol, A  
Loop 2  ; <-- Increase this value to scroll faster.  
    SendMessage, 0x114, 0, 0, %fcontrol%, A  ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINELEFT.  
return  

~LControl & WheelDown::  ; Scroll right.  
ControlGetFocus, fcontrol, A  
Loop 2  ; <-- Increase this value to scroll faster.  
    SendMessage, 0x114, 1, 0, %fcontrol%, A  ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINERIGHT.  
return  

Finally, since mouse wheel hotkeys generate only down-events (never up-events), they cannot be used as key-up hotkeys.

[Source: Here]

share|improve this answer

I recommend solution from http://lifehacker.com/5626708/use-autohotkey-to-scroll-backwards-in-the-command-prompt-by-keyboard

Personally I prefer use LWin key as modifier (to avoid collision with Emacs key binding):

LWin & PgUp::
  Send {WheelUp}
Return

LWin & PgDn::
  Send {WheelDown}
Return

This solution distinct from yhw42 solution as much simple to understand and it uses standard Windows settings for scrolling (how fast to scroll).

NOTE This techniques useful on notebooks (as touchpad can be useless for some user) and for users that dislike mouse. Mouse event send to active GUI elements, so you need proper place mouse position.

share|improve this answer

This is a script I just worked up. Press 0 and Up or Down Arrow keys to operate. If you don't have a numpad on your computer, you can always customize the two keys as you see fit. It works so that you may hold down 0 and an arrow key and continue speed scrolling. Perhaps better than a scroll wheel itself?

0 & Up::
Loop
{
Send {WheelUp}
GetKeyState, T, Down
If T=U ; U is a state for up, D is a state for down
  Break
}
Return

0 & Down::
Loop
{
Send {WheelDown}
GetKeyState, T, Down
If T=U ; U is a state for up, D is a state for down
  Break
}
Return
share|improve this answer

Your Answer

 
discard

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.