Page 1 of 1

Mozilla Firefox: scroll by small amounts

Posted: 05 Oct 2019, 01:13
by jeeswg
- In Firefox, you can scroll by using the arrow keys.
- This script uses ctrl+shift+w/a/s/d to scroll.
- This script uses WM_MOUSEWHEEL/WM_MOUSEHWHEEL to scroll by tiny amounts. You can replace 1/-1 with greater numbers, for greater movement.
- (You can also use WM_VSCROLL/WM_HSCROLL (commented out). Unusually a non-zero number was required for the lParam. This scrolls by a similar, but smaller, distance to the arrow keys.)

Code: Select all

#IfWinActive ahk_class MozillaWindowClass

;note: tested on Firefox v69
;note: the cursor must be over the Firefox window for WM_MOUSEWHEEL/WM_MOUSEHWHEEL to work

^+w:: ;mozilla firefox - scroll up/down
PostMessage, 0x20A, 1<<16, 0,, A ;WM_MOUSEWHEEL := 0x20A
;PostMessage, 0x115, 0, 1,, A ;WM_VSCROLL := 0x115 ;SB_LINEUP := 0
return

^+s:: ;mozilla firefox - scroll up/down
PostMessage, 0x20A, -1<<16, 0,, A ;WM_MOUSEWHEEL := 0x20A
;PostMessage, 0x115, 1, 1,, A ;WM_VSCROLL := 0x115 ;SB_LINEDOWN := 1
return

^+a:: ;mozilla firefox - scroll left/right
PostMessage, 0x20E, -1<<16, 0,, A ;WM_MOUSEHWHEEL := 0x20E
;PostMessage, 0x114, 0, 1,, A ;WM_HSCROLL := 0x114 ;SB_LINELEFT := 0
return

^+d:: ;mozilla firefox - scroll left/right
PostMessage, 0x20E, 1<<16, 0,, A ;WM_MOUSEHWHEEL := 0x20E
;PostMessage, 0x114, 1, 1,, A ;WM_HSCROLL := 0x114 ;SB_LINERIGHT := 1
return

#IfWinActive