标题: [原创] ahk 配合 vbs 实现快捷键更改显示、排序方式 [打印本页]
作者: CrLf 时间: 2014-11-7 23:19 标题: ahk 配合 vbs 实现快捷键更改显示、排序方式
选自自用脚本,因 ahk 里的函数有时会卡其他线程,所以部分功能用 vbs 来配合实现:
vbs 部分:- On Error Resume Next
- Dim Shell,SortKey
- Set Shell = WScript.CreateObject("Shell.Application")
-
- hwnd = WScript.Arguments(0)
-
- If WScript.Arguments.Count>1 Then
- SortKey = WScript.Arguments(1)
- Else
- SortKey = "System.ItemNameDisplay;"
- End If
-
- Set windows = Shell.Windows()
-
- For Each win In Shell.Windows()
- If CStr(win.hwnd) = hwnd Then
- If win.Document.SortColumns = "prop:"&SortKey Then SortKey="-"&SortKey
- win.Document.SortColumns = "prop:"&SortKey
- End If
- Next
复制代码
ahk 部分:- #IfWinActive ahk_group WinGroup
-
- ;Alt+12345 对应 5 种显示方式
- !1::send !vx
- !2::send !vs
- !3::send !vn
- !4::send !vl
- !5::send !vd
-
- ;Ctrl+1234 对应 4 种排序方式
- ^1::
- hwnd := getActiveWindowHWND()
- traytip,, %hwnd%`,System.ItemNameDisplay;
- run, "D:\Include\文件夹排序.vbs" %hwnd% System.ItemNameDisplay;
- return
-
- ^2::
- hwnd := getActiveWindowHWND()
- traytip,, %hwnd%`,System.DateModified;
- run, "D:\Include\文件夹排序.vbs" %hwnd% System.DateModified;
- return
-
- ^3::
- hwnd := getActiveWindowHWND()
- traytip,, %hwnd%`,System.ItemTypeText;System.ItemNameDisplay;
- run, "D:\Include\文件夹排序.vbs" %hwnd% System.ItemTypeText;System.ItemNameDisplay;
- return
-
- ^4::
- hwnd := getActiveWindowHWND()
- traytip,, %hwnd%`,System.Size;
- run, "D:\Include\文件夹排序.vbs" %hwnd% System.Size;
- return
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |