Scrolling Horizontally With Mouse Button Like Holding The Shift

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 27 Jun 2022, 08:40

I want to use only mouse to scroll in pages, but whatever I do I can't make it work. I think mouse buttons behave differently than keyboard because in Keybaord a::b holds down b like it is a.

User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by mikeyww » 27 Jun 2022, 09:36

You can post your script below. What happens when you run your script? What should happen instead?

Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 27 Jun 2022, 16:30

mikeyww wrote:
27 Jun 2022, 09:36
You can post your script below. What happens when you run your script? What should happen instead?
Script is this

Code: Select all

XButton2:: send, {Shift Down}
I can do horizontal scroll like I holding shift and turning mouse while up and down , I also stays on in other situations, just keep selecting text all the time even when I am not holding the key. I just want to hold my mouse key like I am holding shift key

also i tried

Code: Select all

XButton2:: send, {Shift}
But this doesn't work neither

User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by mikeyww » 27 Jun 2022, 16:43

Confusing. Your goal is to use the mouse to scroll. Can you describe how scrolling would normally work for you? Does this have anything to do with pressing the Shift key?

Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 28 Jun 2022, 00:25

mikeyww wrote:
27 Jun 2022, 16:43
Confusing. Your goal is to use the mouse to scroll. Can you describe how scrolling would normally work for you? Does this have anything to do with pressing the Shift key?
Yes, scrolling usually is vertical in pages but in pages with high width, like a page that includes a table with a lot of columns one had to scroll in width of the page and that can be done either by using the scrollbar at the bottom of the page (which is very annoying to use) or holding the the shift key and using mouse while to scroll in it. You can test it right now just zoom in in this page using `Ctrl + =`.

P.S.

it is the same "Ctrl" . Ctrl + wheel up/down is changing global zoom on web-browsers. but it doen't work as i map Ctrl to a mouse button

full code again to maybe make things more clear.

Code: Select all

XButton2:: send, {Shift}


XButton1:: send, {Ctrl}
XButton1 & LButton:: send, ^{LButton}

P.S.2

Now I change the script totally, I is just that it ignores the second condition and changed zoom or scroll randomly whenever I press XButton1 or XButton2 without using wheel button.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
FileEncoding , UTF-8

#Persistent

Loop {
if (GetKeyState("XButton2","P") && GetKeyState("WheelDown","P")){
	Send, +{WheelDown}
}
if (GetKeyState("XButton2","P") && GetKeyState("WheelUp","P")){
	Send, +{WheelUp}
}
if (GetKeyState("XButton1","P") && GetKeyState("WheelDown","P")){
	Send, ^{WheelDown}
}
if (GetKeyState("XButton1","P") && GetKeyState("WheelUp","P")){
	Send, ^{WheelUp}
}
}


XButton2::
return
XButton1:: Send, {Ctrl}
XButton1 & LButton:: Send, ^{LButton}


User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by mikeyww » 28 Jun 2022, 05:47

How about:

Code: Select all

XButton2::Shift
:?:

Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 29 Jun 2022, 03:02

mikeyww wrote:
28 Jun 2022, 05:47
How about:

Code: Select all

XButton2::Shift
:?:
that working like a charm, but one issue now is that i tried to do the same for control and that works for scrolling but now i want to be able Ctrl + Click with it on links and it doesn't work. And when i add another line to define xbutton1+click as control Click it doesn't work

Code: Select all

XButton2::Shift
XButton1::Control
; XButton1 & LButton:: Send, ^{LButton}
if i remove comment from the third line i can ctrl+ click but the control doesn't work anymore

Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 29 Jun 2022, 03:08

mikeyww wrote:
28 Jun 2022, 05:47
How about:

Code: Select all

XButton2::Shift
:?:
thank you , it works like a charm now . but the issue is that i can't do this and also combine it with another key, like i can use xbutton1 as control key but i can't control click with it and if i add an extra line (third line below) for control click the first mapping stops to work

Code: Select all

XButton2::Shift
XButton1::Control
; XButton1 & LButton:: Send, ^{LButton}

User avatar
mikeyww
Posts: 26596
Joined: 09 Sep 2014, 18:38

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by mikeyww » 29 Jun 2022, 05:20

I tested with XButton1.

Code: Select all

XButton1::XButton1
XButton1 & LButton::Send ^{LButton}
#If GetKeyState("XButton1", "P")
WheelDown::WheelRight
WheelUp::WheelLeft
#If


Archie2022
Posts: 25
Joined: 06 May 2022, 03:16

Re: Scrolling Horizontally With Mouse Button Like Holding The Shift

Post by Archie2022 » 29 Jun 2022, 05:57

mikeyww wrote:
29 Jun 2022, 05:20
I tested with XButton1.

Code: Select all

XButton1::XButton1
XButton1 & LButton::Send ^{LButton}
#If GetKeyState("XButton1", "P")
WheelDown::WheelRight
WheelUp::WheelLeft
#If
This works , thank you very much

Post Reply

Return to “Ask for Help (v1)”