Remapping clicks in Firefox

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
newbieforever
Posts: 493
Joined: 24 Aug 2016, 03:34

Remapping clicks in Firefox

Post by newbieforever » 01 Apr 2023, 22:27

I am new in Firefox (111, Portable). According to my settings a click on a link opens the target page in such a manner:
Click = in same Tab, Ctrl+Click = in new Tab, Shift+Click = in new window.

I would like to open in a new window by clicking Ctrl+Click. The following doesn't work, FF still opens in a new tab.

Code: Select all

#If winActive("ahk_exe firefox.exe") 
^LButton::
  Send +{LButton}
  ;MsgBox Ctrl+Click!
Return
#IfWinActive

GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: Remapping clicks in Firefox

Post by GEV » 02 Apr 2023, 02:21

Try

Code: Select all

#IfWinActive ahk_exe firefox.exe 

	^LButton::
		Send {Shift Down}{LButton Down}
		Sleep, 100 ; or more
		Send {LButton Up}{Shift Up}
	Return

#IfWinActive

newbieforever
Posts: 493
Joined: 24 Aug 2016, 03:34

Re: Remapping clicks in Firefox

Post by newbieforever » 02 Apr 2023, 08:27

@GEV: A great tip, thank you!

- With Sleep between 200 and 400 the click sometimes opens the page in a new window, with 500 this seems to happen reliably.
- However, in all these cases the page is also opened in a new tab, which is the original function of Ctrl+Click. Any idea?

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

Re: Remapping clicks in Firefox

Post by mikeyww » 02 Apr 2023, 08:42

This one worked here.

Code: Select all

#Requires AutoHotkey v1.1.33
#If WinActive("ahk_exe firefox.exe")
^LButton Up::
KeyWait Ctrl
Send +{LButton}
SoundBeep 1500
Return
#If

newbieforever
Posts: 493
Joined: 24 Aug 2016, 03:34

Re: Remapping clicks in Firefox

Post by newbieforever » 02 Apr 2023, 08:53

@GEV: (edited) @mikeyww:

I am using AHK 1.1.36, but the result is the same, the page is still opened in a new tab too.
Last edited by newbieforever on 02 Apr 2023, 09:12, edited 1 time in total.

GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: Remapping clicks in Firefox

Post by GEV » 02 Apr 2023, 09:05

Maybe your Firefox version or your system is a bit slower as mine. Try the code of mikeyww.

newbieforever
Posts: 493
Joined: 24 Aug 2016, 03:34

Re: Remapping clicks in Firefox

Post by newbieforever » 02 Apr 2023, 09:13

Sorry, I was confused.

Both scripts do the same, the page is still opened in new tab too...

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

Re: Remapping clicks in Firefox

Post by mikeyww » 02 Apr 2023, 09:33

If you have closed all other scripts, have no other code, saved and reloaded this script, and use no other hotkey managers, I'm not sure how that is possible, but you can try installing the keyboard hook. I added a beep for testing, so you should hear two beeps if this hotkey subroutine begins and ends.

Code: Select all

#Requires AutoHotkey v1.1.33
#InstallKeybdHook
#If WinActive("ahk_exe firefox.exe")
^LButton Up::
SoundBeep 2000
KeyWait Ctrl
Send +{LButton}
SoundBeep 1500
Return
#If

newbieforever
Posts: 493
Joined: 24 Aug 2016, 03:34

Re: Remapping clicks in Firefox

Post by newbieforever » 02 Apr 2023, 10:22

???

Code: Select all

004: Return (28.55)
003: if WinActive("ahk_exe firefox.exe")  
003: if WinActive("ahk_exe firefox.exe")  
005: SoundBeep,2000 (0.17)
006: KeyWait,Ctrl (0.41)
007: Send,+{LButton} (0.06)
008: SoundBeep,1500 (0.17)
009: Return (9.78)
Sorry sorry sorry: I am using a touch screen. This behavior is only shown with Ctrl+Touch. With Ctrl+Click the page is not opened in a new tab.

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

Re: Remapping clicks in Firefox

Post by mikeyww » 02 Apr 2023, 10:42

I do not have an answer, but some of the other forum posts about touchscreens might shed some light on this. Best of luck.

Post Reply

Return to “Ask for Help (v1)”