Firefox RMB+Wheel navigation

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Prostrelov
Posts: 14
Joined: 22 Mar 2018, 00:41

Firefox RMB+Wheel navigation

24 Apr 2018, 10:29

Hi.
Here is a sccript to use RMB+Wheel to navigate between Firefox tabs.
It works but i cant manage one issue:
after you use RMB+Wheel to switch to next tab,
rmb invokes context menu only after second time you press rmb.

Code: Select all

; FIREFOX TAB NAVIGATION
#IfWinActive, ahk_class MozillaWindowClass
RButton & WheelUp::
{
	Wheel=1
	SendInput, ^+{TAB}
}
return
#IfWinActive, ahk_class MozillaWindowClass
RButton & WheelDown::
{
	Wheel=1
	SendInput, ^{TAB}
}
return
#IfWinActive, ahk_class MozillaWindowClass
RButton Up::
If not (Wheel){
    SendInput, {RButton}
}
Wheel:=0
Return
And if i use this variation each time we release RMB+WHeel it invokes contextual menu and we don't need it

Code: Select all

; FIREFOX TAB NAVIGATION
#IfWinActive, ahk_class MozillaWindowClass
~RButton & WheelUp::
{
	SendInput, ^+{TAB}
}
return
#IfWinActive, ahk_class MozillaWindowClass
~RButton & WheelDown::
{
	SendInput, ^{TAB}
}
return
}
Return
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Firefox RMB+Wheel navigation

25 Apr 2018, 02:08

Hallo,
not optimal but try:

Code: Select all

#IfWinActive, ahk_class MozillaWindowClass
~RButton & WheelUp::
	Wheel=1
	SendInput, ^+{TAB}
return
~RButton & WheelDown::
	Wheel=1
	SendInput, ^{TAB}
return
~RButton Up::
If Wheel
{
    Sleep, 100
	SendInput, {Esc}
	Wheel:=0
}
#If
Prostrelov
Posts: 14
Joined: 22 Mar 2018, 00:41

Re: Firefox RMB+Wheel navigation

25 Apr 2018, 02:15

Nope. Sory but script you provide also opens rmb context menu after firefox tab changed (on rmb release).
And thats what i try to avoid.
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Firefox RMB+Wheel navigation

25 Apr 2018, 02:38

Hallo,
I know it opens, but it should go away immediately because of SendInput, {Esc}. Try to enlarge the sleep in front of it
Prostrelov
Posts: 14
Joined: 22 Mar 2018, 00:41

Re: Firefox RMB+Wheel navigation

25 Apr 2018, 15:37

Nope. Doesn't help.
User avatar
YoucefHam
Posts: 372
Joined: 24 Aug 2015, 12:56
Location: Algeria
Contact:

Re: Firefox RMB+Wheel navigation

26 Apr 2018, 12:02

try this

Code: Select all

SendMode Input

RButtonDown = 0

; FIREFOX TAB NAVIGATION
#If WinActive("ahk_class MozillaWindowClass") and !RButtonDown

RButton::
KeyWait, RButton, U T0.4
if ErrorLevel
{
	RButtonDown = 1
	Send, {Ctrl Down}{Tab}
	KeyWait, RButton, U
	Send, {Ctrl Up}
}
else
	Send, {RButton}
RButtonDown = 0
Send, {Blind}
return

#If WinActive("ahk_class MozillaWindowClass") and RButtonDown

*WheelUp::
Send, {Left}
return

*WheelDown::
Send, {Right}
return
:wave: There is always more than one way to solve a problem. ;)
Prostrelov
Posts: 14
Joined: 22 Mar 2018, 00:41

Re: Firefox RMB+Wheel navigation

26 Apr 2018, 23:12

Ok. This one doesn't invoke unnecessary contextual menu after we use rmb+wheel.
But it scroll only one tab at a time. Then you should release rmb and scrol another one tab at a time.
It also form time to time scroll tabs via rmb with not scroll pressed.

And this one works just fine:

Code: Select all

; FIREFOX TAB NAVIGATION
SendMode Input
RButtonDown = 0
#If WinActive("ahk_class MozillaWindowClass") and !RButtonDown
RButton::
KeyWait, RButton, U T0.2
if ErrorLevel
{
	RButtonDown = 1
	Send, {Ctrl Down}
	KeyWait, RButton, U
	Send, {Ctrl Up}
}
else
	Send, {RButton}
RButtonDown = 0
Send, {Blind}
return
#If WinActive("ahk_class MozillaWindowClass") and RButtonDown
*WheelUp::
Send, ^+{TAB}
return
#If WinActive("ahk_class MozillaWindowClass") and RButtonDown
*WheelDown::
Send, ^{TAB}
return
So far many thanks for help guys.
Autohotkey is a great software and have great support and comunity.
I wish some day Autohotkey learn how to print out LogMessages to the current display right through OpenGL.
It would be really handy.
Prostrelov
Posts: 14
Joined: 22 Mar 2018, 00:41

Re: Firefox RMB+Wheel navigation

11 May 2019, 03:51

Its me again.
Unfortunately the code above some how conflicts with other config stuff.
For example if we place ;FIREFOX CODE PART first in line than ;WINDOW ARRANGE CODE PART would not work. And vice versa.

Code: Select all

; WINDOW ARRANGE CODE PART
$#LButton:: Send, {Blind}#{Left}
$#RButton:: Send, {Blind}#{Right}
$#MButton:: Send, {Blind}#{Up}


; FIREFOX CODE PART
SendMode Input
RButtonDown = 0
#If WinActive("ahk_class MozillaWindowClass") and !RButtonDown
RButton::
KeyWait, RButton, U T0.2
if ErrorLevel
{
	RButtonDown = 1
	Send, {Ctrl Down}
	KeyWait, RButton, U
	Send, {Ctrl Up}
}
else
	Send, {RButton}
RButtonDown = 0
Send, {Blind}
return
#If WinActive("ahk_class MozillaWindowClass") and RButtonDown
*WheelUp::
Send, ^+{TAB}
return
#If WinActive("ahk_class MozillaWindowClass") and RButtonDown
*WheelDown::
Send, ^{TAB}
return
I assume that its a "SendMode Input" operator that cause the problems.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Mannaia666, wpulford and 411 guests