; ===== Autohotkey script for Windows Explorer ===== ; Sets two hotkeys: ; Ctrl+G - Moves the selected files to a GroupNN folder ; Ctrl+Shift+G - Moves the files from selected folders to an upper level, ; then removes those directories ; ; For the script to function properly, please go to Explorer's ; Tools - Folder Options - View menu and ensure that ; 'Display the full path in the address bar' is on ; and 'Hide extensions for known file types' is off ; ; (c)2008 by YasonBy ; Feel free to modify :) ; ===== Autohotkey cкрипт для Проводника ===== ; Устанавливает две горячие клавиши: ; Ctrl+G - Переносит выделенные файлы в папку вида GroupNN ; Ctrl+Shift+G - Переносит файлы из выделенных папок уровнем выше, ; затем удаляет эти выделенные папки ; ; Для корректной работы нужно зайти в Tools - Folder Options - View ; и включить Display the full path in the address bar ; и выключить Hide extensions for known file types ; ; (c)2008 by YasonBy ; Исходник свободен, делайте что хотите :) #NoEnv SendMode Input ; Defines a new group name and returns full path to it ; Определяет имя новой группы и возвращает полный путь к ней GetNewGroupName(dir) { loop 100 { groupPath = %dir%\Group%A_Index% If !InStr(FileExist(groupPath),"D") break } Return, groupPath } ;Sets the input focus to the file list ; Устанавливает фокус ввода на список файлов FocusFolderView() { ControlFocus, SysListView321 } ; Returns the current path from explorer's address bar ; Возвращает путь из адресной строки эксплорера GetExplorerDirectory() { ControlGetText, path, Edit1 ;getting current directory return %path% } ; Navigates Explorer into the specified directory ; Переводит эксплорер в указанную папку SetExplorerDirectory(dir) { ControlSetText, Edit1, %dir% ; change directory ControlSend, Edit1, {ENTER} ; press Enter FocusFolderView() } ; Moves the 'source' file or directory into the 'dest' directory ; Перемещает файл или папку source в папку dest MoveFileOrDir(source, dest) { attributes := FileExist(source) IfInString, attributes, D { FileMoveDir, %source%, %dest%, 1 } else { FileMove, %source%, %dest% } } ; Moves the selected files to a GroupNN folder ; Переносит выделенные файлы в папку вида GroupNN GroupSelectedFiles() { currentDir := GetExplorerDirectory() ClipSaved := ClipboardAll clipboard = FocusFolderView() Send, {CTRL DOWN}c{CTRL UP} ClipWait,2 If !clipboard, return ; nothing selected - nothing to do newGroupDir := GetNewGroupName(currentDir) FileCreateDir, %newGroupDir% Loop, parse, clipboard, `n, `r { fileName = %A_LoopField% MoveFileOrDir(fileName, newGroupDir) } Clipboard := ClipSaved ClipSaved = ; Uncomment this, if you want to move into the created group ; Раскомментировать, если нужно переходить в только что созданную группу ; SetExplorerDirectory(newGroupDir) Send, {F5} } ; Moves the files from selected folders to an upper level, then removes those directories ; Переносит файлы из выделенных папок уровнем выше, затем удаляет эти выделенные папки UngroupSelectedFiles() { currentDir := GetExplorerDirectory() ClipSaved := ClipboardAll clipboard = FocusFolderView() Send, {CTRL DOWN}c{CTRL UP} ClipWait,1 Loop, parse, clipboard, `n, `r { groupPath = %A_LoopField% attributes := FileExist(groupPath) IfInString, attributes, D { Loop, %groupPath%\*.*,1,0 { MoveFileOrDir(A_LoopFileFullPath, currentDir) } FileRemoveDir, %groupPath%, 0 ;non-recursive } } Clipboard := ClipSaved ClipSaved = Send, {F5} } ; Горячие клавиши только для Windows Explorer'а (WinXP x64) #IfWinActive, ahk_class ExploreWClass ^g:: KeyWait Control GroupSelectedFiles() return ^+g:: KeyWait Control KeyWait Shift UngroupSelectedFiles() return #IfWinActive ; Горячие клавиши только для Windows Explorer'а (WinXP) #IfWinActive, ahk_class CabinetWClass ^g:: KeyWait Control GroupSelectedFiles() return ^+g:: KeyWait Control KeyWait Shift UngroupSelectedFiles() return #IfWinActive