I want to end up with a variable containing a number between 1 and 8, representing the current file explorer view layout (Extra large icons, Large icons, Medium icons, List, Details, etc.). Ideally, it would be the number I would use with Ctrl-Shift-<#> shortcut to achieve that view.
The final result is a key that cycles through the views. I've found a few examples here that do something similar, but they all use radically different methods and are typically not commented, so I'm having trouble picking out the pieces I might need. For me, the only missing piece is reading the setting info.
Here's what I'm currently doing:
Code: Select all
; Select the key to drive the action. In my case, the numberpad slash key.
NumpadDiv::
;
; Check if file explorer (CabinetWClass in Win 10) is running on the system.
IfWinExist, ahk_class CabinetWClass
{
; If it is running but not active (minimized or behind another window), shift focus back to it.
IfWinNotActive, ahk_class CabinetWClass
WinActivate, ahk_class CabinetWClass
; Now that were in an active file explorer window, figure out what the current view setting is.
view = ??? <------Help!
; Increment the view variable, but if it's out of range, reset it back to 1.
if ++view > 8
view = 1
; Rather than mess with dll or put commands, just translate the incremented view to a keyboard function.
; Send, {Ctrl Down}{lshift Down}%view%{lshift Up}{Ctrl Up}
}
; Otherwise, if no file explorer is running, use the Windows shortcut to launch one.
Else
Send, {LWin Down}e{LWin Up}
; And, we're done.
Return