Тема: AHK (Help2AHK_L): Определение текущего пути в окне Проводника
Скрипт из Коллекции. На AHK_L ни гу-гу, — конвертнуть бы.
F11::
hWnd := WinExist("A")
WinGetClass wClass, ahk_id %hWnd%
If (wClass != "ExploreWClass" and wClass != "CabinetWClass")
MsgBox Используйте только в окне Проводника!
Else
MsgBox % GetWindowsExplorerPath(hWnd)
Return
;=================================================
GetWindowsExplorerPath(_hWnd)
{
local pid, hMem, pv, pidl, pidl?, explorerPath
If (A_OSType = "WIN32_NT")
{
pid := DllCall("GetCurrentProcessId")
SendMessage 0x400 + 12 ; CWM_GETPATH = WM_USER + 12
, pid, 0, , ahk_id %_hWnd%
hMem := ErrorLevel
if (hMem != 0)
{
pv := DllCall("Shell32\SHLockShared"
, "UInt", hMem, "UInt", pid)
if (pv != 0)
{
pidl := DllCall("Shell32\ILClone", "UInt", pv)
DllCall("Shell32\SHUnlockShared", "UInt", pv)
}
DllCall("Shell32\SHFreeShared"
, "UInt", hMem, "UInt", pid)
}
}
VarSetCapacity(explorerPath, 512, 0)
DllCall("Shell32\SHGetPathFromIDList"
, "UInt", pidl, "Str", explorerPath)
Return explorerPath
}