Mapping arrow keys to scroll wheel

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Pyewacket
Posts: 2
Joined: 14 Apr 2019, 12:16

Mapping arrow keys to scroll wheel

14 Apr 2019, 12:41

Can't get it to work no matter what I do. Tried the following:

Code: Select all

#IfWinActive ahk_class Azumanga Main Window
wheelup::
Send, {up}
return
wheeldown::
Send, {down}
return

Code: Select all

#IfWinActive ahk_class Azumanga Main Window
wheelup::
SendInput, {up}
return
wheeldown::
SendInput, {down}
return

Code: Select all

#IfWinActive ahk_class Azumanga Main Window
wheelup::up
wheeldown::down
Sticking "returns" in to that last script didn't help either.

Ideally I would like to be able to rebind all four arrow keys to the scroll wheel, left arrow for left scroll on the wheel, right arrow for right scroll, and up and down for the up and down scroll. But I can't even get up and down to work.

Wheelup/down direct assignments lead to continuous scrolling.

Using Send only works sometimes - eg a single click on the scroll wheel is only recognized sometimes. IF CAPS LOCK IS ON when you start the script, scrolling up and down with the mouse wheel keeps toggling CAPS LOCK, and (again) SOMETIMES may result in the desired action (eg a press of the up or down arrow)

SendInput appears to behave exactly the same as Send.

I have a wireless Logitech M570 trackball. I have been able to reconfigure it in other games. Logitech's software will only allow me to reprogram the 2 extra keys (which are being used for z and c in this game because that is what the game uses instead of return and esc) and the middle mouse CLICK, not the scroll wheel. The game is Reccetear which has a stupidly backwards key binding that does not allow you to rebind to the mouse and which does not use the mouse at all.

Help?
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Mapping arrow keys to scroll wheel

14 Apr 2019, 15:01

Try this:

Code: Select all

#IfWinActive ahk_class Azumanga Main Window
wheelup::
SendInput, {up down}
Sleep, 100
SendInput, {up up}
return
wheeldown::
SendInput, {down down}
Sleep, 100
SendInput, {down up}
return
Increase or decrease the sleep time to adjust how long the up and down keys should be pressed.
Pyewacket
Posts: 2
Joined: 14 Apr 2019, 12:16

Re: Mapping arrow keys to scroll wheel

14 Apr 2019, 17:14

So you have to simulate the up AND down for each key? LOL! Ok that probably just makes autohotkey really powerful for some reasons and actions that don't apply to me.

So thanks. The up and down keys now work, but left and right aren't mapping properly.

Code: Select all

#IfWinActive ahk_class Azumanga Main Window

wheelup::
SendInput, {up down}
Sleep, 100
SendInput, {up up}
return

wheeldown::
SendInput, {down down}
Sleep, 100
SendInput, {down up}
return

wheelleft::
SendInput, {left down}
Sleep, 100
SendInput, {left up}
return

wheelright::
SendInput, {right down}
Sleep, 100
SendInput, {right up}
return
I can achieve walking motion up and down but not left or right. It also fails to go left or right in menus where the arrow keys work. Up and down are working flawlessly in the menus and will also allow me to take one "step" at a time to walk the game avatar around. Wheel left and right don't appear to do anything at all.

Is there something different about the WheelLeft and WheelRight that requires a different method from up and down? I have side scrolling set to 50 characters at a time (it was set to 3) but I'm not sure that value is at all relevant since I'm not sidescrolling through text.

I tried the direct approach too (WheelLeft::Left) and that didn't work either. DId nothing. Can't find a website that would let me test side scrolling to make sure the scroll wheel tilt still works, just in case. It USED to work, last time I had a reason to use it.

I just checked and any motion other than scrollup/down on the scroll wheel is treated as a middle mouse button click, INCLUDING when I try to tilt right or left. Possibly this function is simulated in software rather than being a hard assignment. It may not be possible for me to use the horizontal scroll function in this way. At least not on this mouse. (Logitech M570 trackball).
Last edited by Pyewacket on 14 Apr 2019, 17:48, edited 1 time in total.
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Mapping arrow keys to scroll wheel

14 Apr 2019, 17:32

Pyewacket wrote:
14 Apr 2019, 17:14
So you have to simulate the up AND down for each key? LOL! Ok that probably just makes autohotkey really powerful for some reasons and actions that don't apply to me.
You don't always have to do it. You could just do a::b to make the 'b' key act like the 'a' key. The wheel scroll actions are different than keys, though.
Pyewacket wrote:
14 Apr 2019, 17:14
Is there something different about the WheelLeft and WheelRight that requires a different method from up and down?
My assumption is that the wheel left and right actions are recognized as mouse buttons, as opposed to scroll directions, so, yeah, you may need to do something different than what works for the up and down actions. I'm a little surprised that WheelLeft::Left doesn't work, because I would've guessed that it would. Next, I would try these variations:

Code: Select all

WheelLeft::SendInput, {Left}
WheelRight::SendInput, {Right}

Code: Select all

WheelLeft::SendEvent, {Left}
WheelRight::SendEvent, {Right}

Code: Select all

WheelLeft::
  SendInput, {Left DownR}
  Sleep, 100
  SendInput, {Left Up}
Return
WheelRight::
  SendInput, {Right DownR}
  Sleep, 100
  SendInput, {Right Up}
Return

Code: Select all

WheelLeft::
  SendEvent, {Left DownR}
  Sleep, 100
  SendEvent, {Left Up}
Return
WheelRight::
  SendEvent, {Right DownR}
  Sleep, 100
  SendEvent, {Right Up}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: UncouthGoose and 122 guests