How to get the files list according to the files order in the explorer window?

Get help with using AutoHotkey and its commands and hotkeys
jly
Posts: 11
Joined: 30 Sep 2020, 06:06

How to get the files list according to the files order in the explorer window?

Post by jly » 29 Oct 2020, 10:40

How to get the files list according to the files order in the explorer window?

There are a lot of files to be processed, and some explorer windows have tens of thousands or hundreds of thousands of files.


One way is:
Use the Loop Files method to get, the order of the obtained files is different from that in the window.
This also cannot get the file list in the searched window.

The file order in the file window is natural sorting,
as well as modification date, file type, file size sorting, etc.,
and various sorts are combined with natural sorting.

It is very troublesome to restore the files obtained by the Loop Files method to the original order in the explorer window!



Another way :
for window in ComObjCreate("Shell.Application").Windows
if window.HWND = WinExist("A")
. .. .this_window := window
for item in this_window.Document.Folder.Items
. .. .file_path := item.Path

This method can also obtain the file list in the searched window.
The disadvantage is that the speed of obtaining is relatively slow.
When the number of files is thousands or even tens of thousands, it will take a long time.


Is there any other better way to get the file list according to the file order in the explorer window?
Or is there any script in this regard for reference?

Return to “Ask For Help”