! Требует запуска интерпретатора Autohotkey.exe. Страница загрузки
Code: Select all
; Скрипт для открытия папок из проводника в текущем экземпляре Far-а.
; Если выделена папка, открывает ее
; если выделен файл, открывает его директорию и ставит на него курсор
; если ничего не выделено, открывает тот же каталог
; Сочетание клавиш по-умолчанию - Shift+Enter
MyHotkey := "!Enter" ; "+" - Shift, "!" -Alt, "^" - Ctrl, "#" - Win
; Для добавления в автозагрузку кидаем ярлык к интерпретатору AutoHotKey.exe со скриптом в параметрах.
#NoEnv
#SingleInstance Force
#NoTrayIcon
#KeyHistory 0
SetBatchLines -1
ListLines, Off
SetTitleMatchMode, 2
SetWorkingDir, %A_ScriptDir%
#IfWinActive, ahk_exe explorer.exe
Hotkey, %MyHotkey%, gett
gett:
gettt()
Return
gettt() {
if !(Path:=_GetSelection())
Return
IfWinExist Far ahk_class VirtualConsoleClass
WinActivate
Else IfWinExist Far ahk_class ConsoleWindowClass
WinActivate
Else
Return
FileGetAttrib, Attributes, %Path%
IfInString, Attributes, D
{
SendInput {Esc}cd{Space}"%Path%"{Enter}
} else {
SplitPath, Path, name, outDir
SendInput {Esc}cd{Space}"%outDir%"{Enter}
SendInput !%name%
}
}
Return
#If
_GetSelection(hwnd="") {
hwnd := hwnd? hwnd:WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (class ~= "Progman|WorkerW") {
ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%
Loop, Parse, files, `n, `r
ToReturn .= A_Desktop "\" A_LoopField "`n"
}
else if (class ~= "(Cabinet|Explore)WClass") {
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
sel := window.Document.SelectedItems
for item in sel
ToReturn .= item.path "`n"
}
if !ToReturn
ToReturn := ExplorerPath(hwnd)
return Trim(ToReturn,"`n")
}
ExplorerPath(_hwnd) {
for Item in ComObjCreate("Shell.Application").Windows
if (Item.hwnd = _hwnd)
return, LTrim(Item.LocationURL, "file:///")
}