Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created December 23, 2022 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OKsign/2b91adc75ea4553ed04f5966e9ef7506 to your computer and use it in GitHub Desktop.
Save OKsign/2b91adc75ea4553ed04f5966e9ef7506 to your computer and use it in GitHub Desktop.
;The Combination of 3 scripts (links below) and a small change by me in order to work with apps on Windows 11.
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/596097#596097
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/1633691#1633691
;https://superuser.com/questions/13763/horizontal-scrolling-shortcut-in-windows/825291#825291
; Scroll speed parameter
ScrollSpeed=4
; OneNote horizontal scroll
#IfWinActive, ahk_exe ONENOTE.EXE
+WheelUp::WheelLeft
+WheelDown::WheelRight
return
; PowerPoint horizontal scroll
#IfWinActive, ahk_exe POWERPNT.EXE
+WheelUp::ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,0,ScrollSpeed)
+WheelDown::ComObjActive("PowerPoint.Application").ActiveWindow.SmallScroll(0,0,ScrollSpeed,0)
return
; Word horizontal scroll
#IfWinActive, ahk_exe WINWORD.EXE
+WheelUp::ComObjActive("Word.application").ActiveWindow.SmallScroll(0,0,0,ScrollSpeed)
+WheelDown::ComObjActive("Word.application").ActiveWindow.SmallScroll(0,0,ScrollSpeed,0)
return
; Excel horizontal scroll
#IfWinActive ahk_exe EXCEL.EXE
+WheelDown::WheelRight
+WheelUp::WheelLeft
return
; Explorer horizontal scroll
#IfWinActive ahk_exe Explorer.EXE
+WheelDown::WheelRight
+WheelUp::WheelLeft
return
; wordpad horizontal scroll
#IfWinActive ahk_exe wordpad.EXE
+WheelUp:: ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 4 ; <-- 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
+WheelDown:: ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 4 ; <-- 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
#IfWinActive
+WheelDown::WheelRight
+WheelUp::WheelLeft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment