Change Windows Open Save Dialog to Dopus lister location

Hello - here is a helpful AutoHotkey script to change Windows File Open Save Dialog to Dopus lister location. Works with AutoHotkey Classic and above.

If a Windows File Open Save dialog is open - pushing Ctrl+L will change the location to that of the last active Dopus source lister.

For Windows 7:

#IfWinActive, ahk_class #32770
;Win7 COMDLG32 File Open Save Dialog - Change to Dopus folder
^l::
	; Verify it is COMDLG32 since other windows also have this class
	WinGet, curwindow_controllist, ControlList, A
	controltofind := "DirectUIHWND2"
	If(InStr(curwindow_controllist, controltofind)) {
		Clipboard= ;empty the clipboard so ClipWait has something to wait for
		Run, "C:\bin\dopusrt.exe" /cmd Clipboard SET {sourcepath$}
		ClipWait 1.0
		If (ErrorLevel) {
			MsgBox, Could not get sourcepath from Dopus
			Return
		}
		folder := Clipboard
		If(SubStr(folder,0,1)="""") {
			StringTrimLeft, folder, folder, 1
		}
		If(SubStr(folder,StrLen(folder),1)="""") {
		StringTrimRight, folder, folder, 1
		}
		SendInput, !d
		Sleep, 1000
		ControlFocus, Edit2
		ControlSetText, Edit2, %folder%
		ControlSend , Edit2, {Enter}
		Sleep, 1000
		ControlFocus, Edit1
	} Else {
		Send, ^l
	}
Return

For Windows XP:

#IfWinActive ahk_class #32770

; Set COMDLG32 File Open Save Dialog to Dopus folder
^l::
	ClipSaved := Clipboard ;save the previous clipboard so we can restore it later
	Clipboard= ;empty the clipboard so ClipWait has something to wait for
	Run, "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Clipboard SET {sourcepath$}
	ClipWait
	folder := Clipboard
	Clipboard := ClipSaved ;restore the previous clipboard	
	If(SubStr(folder,0,1)="""") {
		StringTrimLeft, folder, folder, 1
	}
	If(SubStr(folder,StrLen(folder),1)="""") {
		StringTrimRight, folder, folder, 1
	}
	ControlGetText, previousfilename, Edit1
	ControlSetText, Edit1, %folder%
	ControlFocus, Edit1
	ControlSend , Edit1, {Enter}
	Sleep, 300 ; wait 300 ms for the the new folder to load
	ControlSetText, Edit1, %previousfilename%
	ControlSend , Edit1, {End}
Return

#IfWinActive

Another option is Listary, which we've been working with recently to provide a way for it to get more information out of Opus so it can integrate more tightly.

(The API is part of the latest Opus beta version and documented in the manual, so other things can use it as well if they want.)

Edit: Here's the new Listary beta with the new stuff added on their side, which also needs the latest beta from our side (10.5.0.4).

Nice autohotkey script robertcollier4

I expected this line
Run, "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Clipboard SET {sourcepath$}
to always copy the source path into the clipboard

But It seems that if you have selected a folder inside the Open Save Dialog then the path copied to the clipboard is the selected path, not the source path in Dopus...

is it a side effect of those changes ?

Clipboard SET {sourcepath$} will always copy the source path (if there is one) to the clipboard. Look closely at the script and you'll see it is only doing that temporarily as a way to get the path, and then tries to restore the previous clipboard contents.

There are better ways for external tools/scripts to get the path out of Opus without trashing what's in the clipboard.

Thanks for the clarification Leo, in fact this is the part which is not reliable:

   ControlGetText, previousfilename, Edit1
   ControlSetText, Edit1, %folder%
   ControlFocus, Edit1
   ControlSend , Edit1, {Enter}
   Sleep, 300 ; wait 300 ms for the the new folder to load
   ControlSetText, Edit1, %previousfilename%
   ControlSend , Edit1, {End}

For some reason when a folder is selected in the open save dialog, it will go inside that directory and not inside %folder% (which is correct, i've tested it)

This code however will work:

#IfWinActive ahk_class #32770

^g::
   clipboard=
   Run, %dopus% /cmd Clipboard SET {sourcepath$}
   ClipWait
   SendInput, {F4}{Esc}
   Sleep 200
   SendInput ^v{Enter}
Return

#IfWinActive

Thanks for the heads up

When I read the title of this post, I got all excited because for some reason I thought you were talking about these horrible, ghastly, unreasonable folder browsers that only have a TreeView and no Edit control.
Capture 2020-06-15 04-19-33
When I saw that you weren't, I wanted to write a script that could hack a solution together for the old/ugly dialog as well.

For anyone coming here who would like that as well:
Navigate old Windows Folder Browser dialog to DOpus source location

I have another utility in the pipeline - a spin-off of JumpToFolder which is posted elsewhere on this forum - that is basically a replacement for Listary's QuickSwitch as Listary is abandoned by it's developer.
It already supports a couple of file managers and people asked to support dopus too. So call me interested :smiley:

The API you are referring to, is that the dopusrt.exe /info from the documentation? Or are there other ways, like SendMessage etc?

(sorry for reviving this old thread)

Yes. I checked the release notes for the version mentioned in that thread and it was the one which added that:

It’s quite fast, from out own testing, and using XML avoids compatibility worries if more data is added etc.

If you need any extra information added to the output, let us know. If it’s feasible then we don’t mind adding things people need.

Thanks for the info!

I will take a look at it this weekend. But if it's good enough for Listary, it will very likely be good enough for me too :slight_smile: Thanks!