Tested in Windows 7 Pro 64-bit using AutoHotkey_U64.exe v1.1.24.00
Code: Select all
ShowFullPathInSaveAsDialog()
{
WinWaitActive Save File As ahk_class #32770,, 1
If ErrorLevel <> 0
Return
savePath := "" ; this gets the resulting file path.
ControlGet, comboList, List, , ComboBox1
SendMessage, 0x147, 0, 0, ComboBox1 ; Get selected line #
If ErrorLevel < 0
Return
comboLine := ErrorLevel
arrLines := Array() ; remove previous values.
arrLines := StrSplit(comboList, "`n")
; Get drive letter by going backwards to find first ":".
Loop % comboLine
{
thisLine := arrLines[comboLine - A_Index + 2]
If (Instr(thisLine, ":") > 0) {
thisLine := RegExReplace(thisLine, "i)^.*([a-z]:).*$", "$1") ; remove everything from drive name except "X:"
savePath := thisLine
startLine := comboLine - A_Index + 2 ; line to start going forwards from (the one after the drive letter).
Break
}
}
If savePath = ""
Return ; didn't work - possibly didn't find drive letter.
; Now loop forwards, adding path names.
Loop % comboLine - startLine + 1
{
thisLine := arrLines[startLine + A_Index]
fileType := FileExist(savePath . "\" . thisLine) ; ensure path exists.
If (fileType = "D")
savePath .= "\" . thisLine ; path exists, add to path string.
Else
savePath := RegExReplace(savePath, "\\[^\\]+$", "\" . thisLine) ; replace last path with this one (ie. folder name is on same level as previous one).
}
WinSetTitle, % "Save File As (in " . savePath . ")" ; note must include "Save File As" so dialog can be recognised again.
Return
}
Code: Select all
~^s::F_ShowFullPathInSaveAsDialog() ; global hotkey CTRL-S. Maybe also trap !f + s (File -> Save As)
; While in the Save As dialog, refresh the path upon keypresses or mouseclicks (ie. after changing folders).
#IfWinActive Save File As ahk_class #32770
{
~LButton::
~Enter::
~BS::
F_ShowFullPathInSaveAsDialog()
Return
}