Feb 172015
 
 February 17, 2015  Posted by at 9:32 am AutoHotKey, Dev Environment  Add comments

I was certain that there was a hotkey/keyboard shortcut for horizontal scrolling in VS, Shift + Scroll or Alt + Scroll, but I just can’t get that to work. However, while reading up on AHK I noticed a scroll example and decided to give it a try, and it worked. I had no idea (but I’m not surprised) we have this low level access abstracted in such a nice way with the SendMessage command. Brilliant, just brilliant.

So I don’t take credit for somebody else’s work, this script is found at the bottom of the hotkeys documentation, I’ve only refactored it slightly.

To use this, save in a text file with a .ahk extension after downloading AutoHotKey, and double click to run. Holding down Alt and scrolling gives you horizontal scroll without interfering with zoom or vertical scroll as you can see in the gif.

Kill the script from the task bar tray, or using your favorite command line tool or the task manager. The code I’m scrolling through is the AHK source code, I’m having fun reading it- it’s a good read.

[sourcecode language=”text”]’
~Alt & WheelUp::
scroll(0)
return

~Alt & WheelDown::
scroll(1)
return

scroll(direction)
{
SetTitleMatchMode, 2
ControlGetFocus, fcontrol, Visual Studio
Loop 5
SendMessage, 0x114, %direction%, 0, %fcontrol%, Visual Studio
}
[/sourcecode]

  One Response to “Horizontal scroll in Visual Studio (or other programs) with AutoHotKey”

  1. Another option is to use the following two commands Scroll the current text editor horizontally for my Visual Commander extension and assign to them shortcuts like Ctrl+Right Arrow and Ctrl+Left Arrow.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 11 + 12 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)