Firefox: shortcuts for Bookmarks window

Post your working scripts, libraries and tools for AHK v1.1 and older
freespacing
Posts: 150
Joined: 28 Sep 2016, 11:14
Contact:

Firefox: shortcuts for Bookmarks window

16 Oct 2017, 22:16

Just threw this together to get rid of a persistent gripe: no shortcuts in the bookmarks window.
Ctrl + n creates a new folder
Ctrl + b creates a new bookmark

Some dupe code, no effort made at refactoring.

Code: Select all

; -------------- Hotkeys for Firefox -----------------
#IfWinActive ahk_exe firefox.exe 

; Shortcuts for Bookmarks window
^n:: ; New Folder
MouseGetPos,,,id,NN
ControlGetText, Text, %NN%, ahk_id %id%
if(Text != "Library") {   ; The title of the bookmark window is 'Library'
  Send ^n
  return
} 
; Tooltip Text=%Text%
Send !o
sleep 50
Send o
return

^b:: ; New Bookmark
MouseGetPos,,,id,NN
ControlGetText, Text, %NN%, ahk_id %id%
if(Text != "Library") {   ; The title of the bookmark window is 'Library'
  Send ^b
  return
} 
Send !o
sleep 50
Send b
return


#IfWinActive
	
; -------------- End hotkeys for Firefox -----------------
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Firefox: shortcuts for Bookmarks window

17 Oct 2017, 08:48

Code: Select all

; BEGIN >> HOTKEYS FOR FIREFOX
#IfWinActive Library ahk_class MozillaWindowClass ahk_exe firefox.exe
    ^n:: ; New Folder
        Send, {AppsKey}
        Sleep, 50
        Send, F

        WinWait, New Folder ahk_class MozillaDialogClass ahk_exe firefox.exe,, 3

        If (ErrorLevel) {
            MsgBox, WinWait timed out.
        }
    return

    ^b:: ; New Bookmark
        Send, {AppsKey}
        Sleep, 50
        Send, B

        WinWait, New Bookmark ahk_class MozillaDialogClass ahk_exe firefox.exe,, 3

        If (ErrorLevel) {
            MsgBox, WinWait timed out.
        }
    return
#IfWinActive
; END >> HOTKEYS FOR FIREFOX

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 96 guests