Open current File Explorer window in DOpus?

Is there a way to open/send the current File Explorer window in Directory Opus? Or just bring it up if that path is already open, without opening a duplicate tab?

Ideally, at the same time the File Explorer window should close (without terminating explorer.exe, as AI below once attempted in its varied attempts).

I assume adding a single button in File Explorer to achieve this, cannot be done by the user. It'd be nice as a new feature.

I struggled (with AI of course...) to create code for a DOpus button (as a System-wide Hotkey) but it couldn't get it right. Can this be achieved?

Thanks

Right-clicking the folder in File Explorer (e.g. via the folder tree or path-field component) should give you an Open in Directory Opus option.

I don't think there's an easy way to add buttons to File Explorer (and if there was it'd probably break every few years as they keep changing how its toolbars and buttons work). Adding context menu items to Explorer can be done via the registry, OTOH, if you want something more advanced that checks for duplicate tabs (can be done with built-in Opus commands) and closes the Explorer window (might require AHK or similar).

Thanks. I really wanted to avoid the mouse. If it can't be done via DOpus Hotkey, it's not really a big problem.

If it can be done, I'll try figuring it out myself at some point.

You'd be pushing the key inside File Explorer, so you'd either need to add a hotkey to Explorer (probably best done using AHK or similar) or use a global hotkey that might get in the way everywhere else.

NEWTAB=findexisting is not valid for the file path

AutoHotkey script

; Ctrl+E Redirect Explorer Window to DOpus

#Requires AutoHotkey v2
#SingleInstance
try TraySetIcon("shell32", 265)      ; Set the tray icon


DOpusPath := "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"

HotIfWinActive "ahk_class CabinetWClass"
Hotkey "Ctrl & E", RedirectToDOpus
HotIf



; Redirect Explorer window to DOpus --------------------------------------------------------------------------------------------------

RedirectToDOpus(*) {
    if !explorerItems := explorerGetSelection()
		return
	explorerItemsArray := strSplit(explorerItems, "`n")
	item := explorerItemsArray[1]
	if (item = "::{F874310E-B6B7-47DC-BC84-B9E6B38F5903}")
		item := "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"   ; This PC
	commandLine := '"' DOpusPath '" /acmd=Go "' item '" NEWTAB=deflister,findexisting,tofront'
	winHwnd := winActive("A")
	try {
		run commandLine
		winClose winHwnd
	} catch
		trayTip("The program path does not exist, please modify it in the script!", "RedirectExplorerWindow", 2)
}



; Explorer get selection --- Modified from ntepa's code ------------------------------------------------------------------------------

explorerGetSelection(hwnd := WinExist("A")) {   ; by ntepa -- https://www.autohotkey.com/boards/viewtopic.php?p=529074#p529074
    if !winExist(hwnd) || !RegExMatch(WinGetClass(hwnd), "^((?<Desktop>Progman|WorkerW)|CabinetWClass)$", &Match)
        return
    shellWindows := ComObject("Shell.Application").Windows
    ; get desktop or explorer window.
    if Match.Desktop ; 0x13 = VT_UI4, 0x8 = SWC_DESKTOP
        window := shellWindows.Item(ComValue(0x13, 0x8)).Document
    else {
        try activeTab := ControlGetHwnd("ShellTabWindowClass1", hwnd)
        for w in shellWindows {
		    try {
                if w.hwnd != hwnd
                    continue
                if IsSet(activeTab) {
                    IID_IShellBrowser := "{000214E2-0000-0000-C000-000000000046}"
                    shellBrowser := ComObjQuery(w, IID_IShellBrowser, IID_IShellBrowser)
                    ComCall(3, shellBrowser, "uint*", &thisTab:=0)
                    if thisTab != activeTab
                        continue
                }
                window := w.Document
                break
			}
        }
    }

    Items := ""
    try for i, in window.SelectedItems {
        Items .= (A_Index > 1 ? "`n" : "") i.Path ; append each selected item and add a new line.
    }
	else
        return window.Folder.Self.Path
	catch
	    for window in shellWindows
		    try if (window.hwnd==hwnd)
				for i, in window.SelectedItems
                    Items .= (A_Index > 1 ? "`n" : "") i.Path ; append each selected item and add a new line.

    return Items
}
1 Like

Thank you so much WKen. Your script works beautifully.

After a few quick tests, it does everything right. I think it cannot detect an existing tab if it's on the inactive pane, but it's perfectly fine.

(perhaps related to your NEWTAB remark, but I wouldn't know)

I tested NEWTAB=findinactive and it didn't work.

I'm a ahk fan. Thou for this take I use Listary v5 Listary .

https://www.listary.com/download

V5 is better, not as pretty but has more features they pull out of v6 for a new UI.

I've set a universal hotkey for when I end up in a file explorer window. Ctrl + d, open that folder and selected file in dopus from everywhere, it also works in open\save dialogue windows.

And 2nd key, Ctrl + g will grab the active folder from dopus to automatically switch to it when in any open or save window your in.

The 3rd and main key let's you search and jump thru your indexed folder, including custom keyword folders. Have mine set to match my dopus aliases and favs.

You can jump across 9 hdds in seconds with just the keyboard.

2 Likes

There's a free version, I think, not sure how limited it is... this program makes navigating open\save box with the keyboard so seemless I just got it.

that being said... I have it shut off interacting acting with dopus and everythings. I has deep key hooks and can get in the way. Dopus and everything do need any help, this is nice bridge when outside of them.