GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Change Windows Open Save Dialog to Dopus lister location


#1

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

#2

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).


#3

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 ?


#4

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.


#5

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