I'm Running Out of Hotkeys

Between Dopus and learning AutoHotKey I'm running out hotkeys. let alone remembering What i set to Where or When or If WinActive!!! :rofl:

F1 thru F12 have been re-keyed\re-mapped (with multiple modifiers combos) exclusively for Dopus and Everything functions plus switching between them with one keypress!

This script is not a Dopus script, its written in AutoHotKey. I've set F1 to 1st open both Dopus & Everything, if they are not already open, and then 2nd toggle\switch between them, instantly, from anywhere! i love it! so fast and easy.

Should you decide to use this script you will loose the common "help" function of your F1 key, i almost never use common helps anyway. You could also map any key combo of your choice.

Here is the script if y'all want to play with it...
dopus everything AHK script.txt (1.8 KB)

#Persistent
#SingleInstance force

F1:: ;Launch both Dopus & Eveverything if they are not active, then switch between them instantly.
    TogglePrograms()
return

TogglePrograms()
{
    IfWinNotExist, ahk_exe everything64.exe ; Check if Everything is not already running
    {
        Run, "C:\Program Files\Everything 1.5a\Everything64.exe" ; Launch Everything if it's not running
    }

    IfWinNotExist, ahk_exe dopus.exe ; Check if Directory Opus is not already running
    {
        Run, "C:\Program Files\GPSoftware\Directory Opus\dopus.exe" ; Launch Directory Opus if it's not running
    }

    IfWinExist, ahk_exe dopus.exe
    {
        IfWinActive, ahk_exe dopus.exe
        {
            WinActivate, ahk_exe everything64.exe
            WinWait, ahk_exe Everything64.exe
            Sleep 200
            ControlSend, , ^{L} ; This line bring your curser to the search field automatically if it's not already there.
        }
        else
        {
            WinActivate, ahk_exe dopus.exe
        }
    }
    else
    {
        WinActivate, ahk_exe everything64.exe
        WinWait, ahk_exe Everything64.exe
        Sleep 200
        ControlSend, , ^{L} ; This line bring your curser to the search field automatically if it's not already there.
    }
}


;In this script:
;If Everything (everything64.exe) is not already running, it will be launched.
;If Directory Opus (dopus.exe) is not already running, it will be launched.
;After ensuring both programs are running, the script toggles between them as before.
;Adjust the paths "C:\Path\To\everything64.exe" and "C:\Path\To\dopus.exe" to the actual paths where Everything and Directory Opus executables are located.
;Now, pressing F1 will toggle between Everything and Directory Opus, launching them if they are not already running.

Oh I know the pain :smiley:

I set up multiple common keys with success tho, like Esc, F1, F4... without affecting their usual functions. Context-sentiive keys are amazing but so are double-tap keys, big helpers!! E.g. Win-E to open default DOpus, Win-E-E to open a singlepane window (AHK manual has some good starter scripts here & here). Here's my Esc-handler: for example if Sumatra is active, Esc closes a dialog, then the files one by one, and closes the window if there is no more open file. Been using these and more for years now, seldom got a problem.

; oh I just realized I use Functions.ahk which basically wraps WinGetTitle, var, A... as WinGetTitle("A")
; original source URL is defunct but basically it's a bunch of definitions like this - PM if you want a copy
WinGetTitle(ByRef WinTitle := "", WinText := "", ExcludeTitle := "", ExcludeText := "") {
	WinGetTitle, v, %WinTitle%, %WinText%, %ExcludeTitle%, %ExcludeText%
	Return, v
}
; shortened
EscapeHandler() {
    _is_dialog_win := false
    _active_win_class := WinGetClass("A")
    _is_dialog_win := _active_win_class == "#32770"
    if (WinActive("ahk_exe MPlayerC.exe")) {
        _mpc_title := WinGetTitle("A")
        if (_is_dialog_win == true) {
            Send("{Escape}")
        } else if (InStr(_mpc_title, "Media Player Classic") or InStr(_mpc_title, "MPC-BE x64")) {
            Send("^q")
        } else {
            Send("^w")
        }
    } else if (WinActive("ahk_exe SumatraPDF.exe")) {
        _sumatra_title := WinGetTitle("A")
        $log(A_ThisFunc, "Sumatra: " _sumatra_title)
        if (_is_dialog_win == true) {
            Send("{Escape}")
        } else if (_sumatra_title == "SumatraPDF") {
            Send("^q")
        } else {
            Send("^w")
        }
    } else if (WinActive(cAudioPlayer.check_run)) {
        ;_foobar_title := WinGetTitle("ahk_exe foobar2000.exe")
        _foobar_title := WinGetTitle("A")
        if (_foobar_title == "Facets" or _foobar_title == "Popup Playlist") {
            WinHide("Facets")
            WinHide("Popup Playlist")
        } else {
            Send("{Escape}")
        }
    } else {
        Send("{Escape}")
    }
}

Edit: Just found a copy of Functions.ahk on my gh.

1 Like

i only started teaching myself AHK\Scripting 1 month ago. and yes!!! I NEED A 2ND KEYBOARD!

i have double tap keys set up as well. double tap ESC sends F4 to active window is my fav!

i expanded\doubled the built in windows function launching the task bar items, complete with custom graphics behind my task bar.

#9 opens the control panel, ~#!Numpad1 opens whatever is in taskbar location 11.

explorer_2024-02-09__02-49-01PM__238x49

all this started because i was tired of chasing run away window that would pop up wwwayyyyy in the furthest corner of a new 48in 4k tv\monitor i got a couple months again. #G grabs the window to my mouse! or #C centers the window on the screen....

come to think of it i should change those to ~G and ~C. hahaha.

1 Like

i need to wrap my head around JS so i can really unleash the Power of Dopus!

Well, it's not vanilla JS mind you, it's a very very very old version, so most recent tips you'll find on the net may not work in DOpus. Best way to learn would be learning some JS basics, then studying the scripts from forum users (I got a couple myself, too).

One thing I truly truly wished tho, that DOpus JScript would also support dllcall() like AHK. It opens so many possibilities, it's ridiculous, but that'll be a lot of work for devs for a very small group of users I imagine, so I kept my mouth shut about it for years now :smiley:

1 Like

ha! oh my me you're TroubleChute? it was your youtube video that made me start trying to figure autohotkey! the world gets smaller everday.

Nope, that's a different gentleman, but I'm not shabby with AHK either :wink:

oops. sorry, i just got turned around on github from zenwindows page somehow.

Wonderful, a new program to use. I got hooked by the youtube link provided by xavierarmand. Will nowlook at the other examples posted.

1 Like

good luck and have fun! ahk is a wonderful & endless rabbit hole! as is Dopus!

the fourms on AutoHotKey are extensive! and check out https://www.youtube.com/channel/UCcUAEvpfuE0npAl_B37_3Bw
for some good basics

1 Like

What about multi part hotkey combinations? Something like Ctrl-C A, Ctrl-C B, etc.? This would extend your hotkey name space considerably, and also act as some sort of mnemonic aid. At least it works that way for myself. It is done by pressing the first combination, followed by the second or third character. You can achieve that through the 'add to sequence' function, where you normally would create your hotkey.

3 Likes