Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v1) • Re: sorting files by folder path

$
0
0

Ideas are below.

CODE:

#Requires AutoHotkey v1.1.33
#SingleInstance
specialPath := "C:\Windows|C:\Windows\System32"
regEx := "(" StrReplace(specialPath, "\", "\\") ")"
Loop {
WinWaitActive ahk_class CabinetWClass
hWnd := WinActive("A")
SetTimer Check, 100
SoundBeep 1500
WinWaitNotActive
SetTimer Check, Off
SoundBeep 1000
}

Check:
last := current, current := explorerGetPath()
If (current != last && current ~= regex)
For oWin in ComObjCreate("Shell.Application").Windows
If (hWnd = oWin.Hwnd) {
oWin.Document.GroupBy := "System.ItemTypeText" ; Group by item type
oWin.Document.SortColumns := "prop:-System.ItemNameDisplay;" ; Reverse sort by item name
SoundBeep 2500
}
Return

explorerGetPath(hwnd := 0){ ; https://www.autohotkey.com/boards/viewtopic.php?p=387113#p387113
If hWnd
explorerHwnd := WinExist( "ahk_class CabinetWClass ahk_id " . hwnd )
Else If !explorerHwnd := WinActive("ahk_class CabinetWClass")
explorerHwnd := WinExist("ahk_class CabinetWClass")
If explorerHwnd
For window in ComObjCreate("Shell.Application").Windows
Try If (window && window.hwnd && window.hwnd==explorerHwnd)
Return window.Document.Folder.Self.Path
Return False
}



I know I can use the below code to group by type, but can I set groupby to none after I'm done? I wasn't able to find anything that either reset it, or group by none. Thanks!

CODE:

oWin.Document.GroupBy     := "System.ItemTypeText"  

Statistics: Posted by haomingchen1998 — 24 minutes ago



Viewing all articles
Browse latest Browse all 579

Trending Articles