I am looking for a way to reliably automate various features of the File Explorer Ribbon. I know one way to achieve this is by hitting
Alt and then the correlating key strokes; this would be pretty easy to automate. However, this solution is not always reliable and a bit slow, also the ribbon will flash and possibly change the active ribbon tab. Another simple way to automate the ribbon is first right-clicking an item on the ribbon and then selecting "Add to Quick Access Toolbar". In return this is automatable by hitting
Alt + corresponding number key. This solution is less prone to errors but somewhat tedious to maintain over different computers.
I am looking for a solution which works on any machine by leveraging the underlying ComObject functions.
Example:
Code: Select all
F1::
explorerHwnd := WinExist("A")
Windows := ComObjCreate("Shell.Application").Windows
for window in Windows
if (window.hWnd == explorerHwnd)
sFolder := window.Document
sFolder.CurrentViewMode := 4 ; Details
Return
This works flawlessly, without changing the active ribbon tab (if the ribbon is expanded at all).
Could anybody lead me in the right direction how to figure out the corresponding underlying details of any item on the ribbon?