Explorer column interaction (get/set: which appear, width, ascending/descending order)
Posted: 14 Jun 2017, 20:23
The IColumnManager and IFolderView2 interfaces offer methods to interact with columns in Explorer folder windows.
==================================================
3 example scripts:
Sort folder's contents by date - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 34#p174634
Toggle specific column in File Explorer (then set its order) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 84#p185684
[show 2 columns only: date modified and file type]
Question for jeeswg - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 01#p190801
==================================================
IColumnManager interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
IFolderView2 interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
These functions make it possible to: count/list and add/remove columns programmatically, to get/set which columns are used to sort the files, and to get/set whether the order is ascending/descending.
The JEE_ExpGetInterfaces function for getting access to the interfaces is based on code by and mainly thanks to qwerty12:
Explorer: jump to first file/folder - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 13#p153513
I obtained the offset for each method, for both interfaces by using:
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ShObjIdl.h
which came with Visual Studio.
It seems that with some objects/interfaces you can specify '.MethodName()' but with others you need to use DllCall and NumGet to refer to the methods. There are some details here:
COM interface tutorial
https://maul-esel.github.io/tutorials/C ... faces.html
I also made some comments about retrieving the list of methods for an interface at 'INTERFACES: GET METHOD LIST' at:
jeeswg's objects tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=29232
Note some information can be retrieved, and interaction done, e.g. listing and simulating clicking column headers, via the Acc library, there is an e.g. lower down:
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
Btw it appears that to uniquely identify a column header you need a CLSID and a property identifier, (these are shown in example lower down,) and that some column headers share the same CLSID.
==================================================
[Links: (IColumnManager)]
How to obtain the list of visible columns in a shell view – Windows SDK Support Team Blog
https://blogs.msdn.microsoft.com/winsdk ... hell-view/
windows - Copying file details from Explorer as tabular text - Stack Overflow
https://stackoverflow.com/questions/266 ... bular-text
[Links: (StringFromCLSID)]
DllCall to get idle time until computer sleeps - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=25935
[AHK_L] Custom AutoCompletion for edit control, with drop down list - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/9612 ... down-list/
==================================================
[EDIT:][some code for changing for the view mode in Explorer]
Reading Win 10 File Explorer View Mode - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 46#p132846
==================================================
3 example scripts:
Sort folder's contents by date - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 34#p174634
Toggle specific column in File Explorer (then set its order) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 84#p185684
[show 2 columns only: date modified and file type]
Question for jeeswg - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 01#p190801
==================================================
IColumnManager interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
IFolderView2 interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
These functions make it possible to: count/list and add/remove columns programmatically, to get/set which columns are used to sort the files, and to get/set whether the order is ascending/descending.
The JEE_ExpGetInterfaces function for getting access to the interfaces is based on code by and mainly thanks to qwerty12:
Explorer: jump to first file/folder - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 13#p153513
I obtained the offset for each method, for both interfaces by using:
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ShObjIdl.h
which came with Visual Studio.
It seems that with some objects/interfaces you can specify '.MethodName()' but with others you need to use DllCall and NumGet to refer to the methods. There are some details here:
COM interface tutorial
https://maul-esel.github.io/tutorials/C ... faces.html
I also made some comments about retrieving the list of methods for an interface at 'INTERFACES: GET METHOD LIST' at:
jeeswg's objects tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=29232
Note some information can be retrieved, and interaction done, e.g. listing and simulating clicking column headers, via the Acc library, there is an e.g. lower down:
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
Btw it appears that to uniquely identify a column header you need a CLSID and a property identifier, (these are shown in example lower down,) and that some column headers share the same CLSID.
==================================================
[Links: (IColumnManager)]
How to obtain the list of visible columns in a shell view – Windows SDK Support Team Blog
https://blogs.msdn.microsoft.com/winsdk ... hell-view/
windows - Copying file details from Explorer as tabular text - Stack Overflow
https://stackoverflow.com/questions/266 ... bular-text
[Links: (StringFromCLSID)]
DllCall to get idle time until computer sleeps - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=25935
[AHK_L] Custom AutoCompletion for edit control, with drop down list - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/9612 ... down-list/
==================================================
[EDIT:][some code for changing for the view mode in Explorer]
Reading Win 10 File Explorer View Mode - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 46#p132846