Sunday, May 15, 2011

How to get the Fullpath within the Open-Save-Dialog?

How to get the Fullpath within the Open-Save-Dialog?: "We found a solution in rexx's FolderMenu.

Thanks rexx for your quick help.

The Code has been modified in spots.

Code (Collapse):

#Persistent
SetTimer, Label_GetPathFromOpenSaveDialog, 100
Return

Label_GetPathFromOpenSaveDialog:
WinGet, w_WinID, ID, A
WinGet, w_WinMin, MinMax, ahk_id %w_WinID%
if w_WinMin = -1 ; Only detect windows not Minimized.
return
WinGetClass, w_Class, ahk_id %w_WinID%
if w_Class = #32770
{
ThisPath =
if A_OSVersion = WIN_VISTA
{
ControlGetPos, ToolbarPos,,,, ToolbarWindow322, ahk_id %w_WinID%
if ToolbarPos !=
{
Send, !d ; Set focus on addressbar to enable Edit2
Sleep, 100
ControlGetText, ThisPath, Edit2, ahk_id %w_WinID%
}
}
if ThisPath = ; nothing retrieved, maybe it's an old open/save dialog
{
ControlGetText, ThisFolder, ComboBox1, ahk_id %w_WinID% ; current folder name
ControlGet, List, List,, ComboBox1, ahk_id %w_WinID% ; list of folders on the path
Loop, Parse, List, `n ; create array and get position of this folder
{
List%A_Index% = %A_LoopField%
if A_LoopField = %ThisFolder%
ThisIndex = %A_Index%
}
Loop, % ThisIndex ; add path till root
{
Index0 := ThisIndex - A_Index + 1 ; ThisIndex ~ 1
IfInString, List%Index0%, : ; drive root
{
ThisPath := SubStr(List%Index0%, InStr(List%Index0%, ':')-1, 2) . '\' . ThisPath
break
}
ThisPath := List%Index0% . '\' . ThisPath
}
StringTrimRight, ThisPath, ThisPath, 1
}
ToolTip, %ThisPath%
}
else
ToolTip
Return

- Sent using Google Toolbar"

No comments: