To get here ,I have mix two scripts into a single one:
● script to get path of selected files/folder (but doesn't get path of current folder): https://autohotkey.com/board/topic/6072 ... ntry383065
● script to start a cmd in current folder (which is able to get the path of current folder): https://autohotkey.com/boards/viewtopic.php?t=5796
Code: Select all
#p::MsgBox % Explorer_GetSelection()
Explorer_GetSelection(hwnd="") {
If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") || WinActive("ahk_class Progman") {
WinHWND := WinActive()
For win in ComObjCreate("Shell.Application").Windows
If (win.HWND = WinHWND) {
sel := win.Document.SelectedItems
for item in sel
ToReturn .= item.path "`n"
ToReturnFinal := Trim(ToReturn,"`n")
if (ToReturnFinal == ""){
dir := SubStr(win.LocationURL, 9) ; remove "file:///"
ToReturnFinal := RegExReplace(dir, "%20", " ")
}
}
}
return %ToReturnFinal%
}