Firefox : toggle on/off sidebar - HELP

Get help with using AutoHotkey and its commands and hotkeys
bzzz
Posts: 1
Joined: 18 Feb 2018, 11:57

Firefox : toggle on/off sidebar - HELP

18 Feb 2018, 12:45

Hello,
I'm using Firefox 58.0.2 and i would like to create a toggle on/off shortcut for viewing/hiding sidebar panel.

A button is there ("show sidebars"), but contrary to History or Bookmarks, no shortcut such as CTRL+H or CTRL+B was assigned to Sidebar.

So could someone give me some hint/script to use with AHK to achieve a TOGGLE ON/OFF sidebars ... with Key "F4", that would be perfect.

(F4 was the key used by "All In One Sidebar", a deprecated addon since Firefox use of Web Extension.)

Have a nice day.
User avatar
jeeswg
Posts: 5939
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Firefox : toggle on/off sidebar - HELP

19 Feb 2018, 01:16

I was able to invoke the button using the Acc library.

Code: Select all

;[Acc functions]
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

q:: ;Mozilla Firefox - toggle show/hide Sidebars
WinGet, hWnd, ID, A
;MsgBox, % Clipboard := JEE_AccGetTextAll(hWnd, "`r`n")
oAcc := Acc_Get("Object", "4.25.10", 0, "ahk_id " hWnd)
if (oAcc.accName(0) = "Sidebars")
	oAcc.accDoDefaultAction(0)
oAcc := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
rubaboo
Posts: 7
Joined: 02 Jan 2018, 21:18

Re: Firefox : toggle on/off sidebar - HELP

02 Oct 2018, 20:59

This is very cool! Can it be adapted to invoke the tab history drop-down? (The one that requires right-click on back-forward button.)
User avatar
jeeswg
Posts: 5939
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Firefox : toggle on/off sidebar - HELP

03 Oct 2018, 18:31

- This script right-clicks the Backwards button (commented out code specifies the Forwards button instead).
- Note: Acc is only used to locate the button, the rest is done by the MouseXXX commands.
- Acc can be used to invoke a left-click directly (as shown in commented out code), but I don't know if it can invoke a right-click.

Code: Select all

;[Acc functions]
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

q:: ;firefox - invoke backwards button drop-down list (tested on Firefox v62)
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "4.25.1", 0, "ahk_id " hWnd) ;Backwards
;oAcc := Acc_Get("Object", "4.25.2", 0, "ahk_id " hWnd) ;Forwards
;oAcc.accDoDefaultAction(0) ;left-click
if !(oAcc.accName(0) = "Backwards")
	return

oRect := Acc_Location(oAcc)
vPosX := oRect.x + oRect.w/2
vPosY := oRect.y + oRect.h/2
CoordMode, Mouse, Screen
MouseGetPos, vCurX, vCurY
;MouseMove, % vPosX, % vPosY
MouseClick, R, % vPosX, % vPosY, 1, 0
MouseMove, % vCurX, % vCurY
oAcc := oRect := ""
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
rubaboo
Posts: 7
Joined: 02 Jan 2018, 21:18

Re: Firefox : toggle on/off sidebar - HELP

04 Oct 2018, 18:00

It works! The number is different for me (4.23.8), and the name is "Back", without "…wards".

Return to “Ask For Help”

Who is online

Users browsing this forum: asad41163, AviationGuy, Bing [Bot], Google [Bot], ktbjx and 176 guests