Change Windows Open Save Dialog to Dopus lister location

Share tools which are especially useful in combination with Opus.
robertcollier4
Registered Opus Pro User
Posts: 43
Joined: 14 Sep 2012, 09:25
OS: Windows 7 32-bit
Opus: Directory Opus 11
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.

Code: Select all

#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

Note: If has problem on slower computers, try increasing the Sleep value.
Update: now uses ClipWait for better performance.
Last edited by robertcollier4 on 28 Apr 2013, 12:36, edited 6 times in total.

User avatar
leo
GPSoftware
Posts: 36498
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:
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).

nitrix-ud
Registered Opus Pro User
Posts: 136
Joined: 09 Feb 2005, 16:42
Nice autohotkey script robertcollier4

I expected this line

Code: Select all

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

@Leo
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.

is it a side effect of those changes ?

User avatar
leo
GPSoftware
Posts: 36498
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:
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.

nitrix-ud
Registered Opus Pro User
Posts: 136
Joined: 09 Feb 2005, 16:42
Thanks for the clarification Leo, in fact this is the part which is not reliable:

Code: Select all

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:

Code: Select all

#IfWinActive ahk_class #32770

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

#IfWinActive


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 heads up


Return to “Tools”