用法:选中文件,ctrl+g,自动整理到D盘,通过本实例简单改造可以实现各种自动整理功能,自动化办公的人士可以了解一下!购买文章后,免费给与指导!
用法:选中文件,ctrl+g,自动整理到D盘,通过本实例简单改造可以实现各种自动整理功能,自动化办公的人士可以了解一下!购买文章后,免费给与指导!
[erphpdown]
^g:: this_path := Selected_Files() ; 检测选中的文件 Des_path:="D:\" if (this_path) loop, Parse, this_path , `n, `r ; 在 `r 之前指定 `n, 这样可以同时支持对 Windows 和 Unix 文件的解析. { MoveFilesAndFolders(A_LoopField,Des_path) ; 移动文件 } else MsgBox, 没有选中文件! return ;移动文件或文件夹 MoveFilesAndFolders(SourcePattern, DestinationFolder, DoOverwrite = false) ; 移动匹配 SourcePattern 的所有文件和文件夹到 DestinationFolder 文件夹中且 ; 返回无法移动的文件/文件夹的数目. { ; 首先移动所有文件 (不是文件夹): FileMove, %SourcePattern%, %DestinationFolder%, %DoOverwrite% ErrorCount := ErrorLevel ; 现在移动所有文件夹: loop, %SourcePattern%, 2 ; 2 表示 "只获取文件夹". { FileMoveDir, %A_LoopFileFullPath%, %DestinationFolder%\%A_LoopFileName%, %DoOverwrite% ErrorCount += ErrorLevel if ErrorLevel ; 报告每个出现问题的文件夹名称. MsgBox, 文件夹%A_LoopFileFullPath% 不能移动至%DestinationFolder%. } return ErrorCount } ;检查是否选中文件 Selected_Files() { ;我的电脑句柄 IfWinActive, ahk_class CabinetWClass { for window in ComObjCreate("Shell.Application").Windows if window.HWND = WinExist("A") this_window := window ; 如果多个项目被选中 if(this_window.Document.SelectedItems.Count > 1) { these_files := "" for item in this_window.Document.SelectedItems these_files .= item.Path . "`n" return these_files } else return this_window.Document.FocusedItem.Path } ; 桌面句柄 if(WinActive("ahk_class Progman") || WinActive("ahk_class WorkerW")) { ControlGet, selectedFiles, List, Selected Col1, SysListView321, A ; 如果多个项目被选中 if InStr(selectedFiles, "`n") { these_files := "" loop, Parse, selectedFiles, `n, `r these_files .= A_Desktop . "\" . A_LoopField . "`n" return these_files } else return A_Desktop . "\" . selectedFiles } else return false }
[/erphpdown]
有用
好用呢。
攒分中。。