How to have a Hotkey Switch use more than 4 Cases?
I am trying to create a script that takes advantage of the way the Switch - Case commands work. At the moment I have it working with Cases 1-4, but I cannot figure out how to go above that and I need it to cycle through 25 Cases for a DLL viewer I'm trying to put together. I believe it's the math of the Switch command, but I do not understand it enough. This is what I have so far. Thank you to any able to help me figure this out.
^T::
Switch ++N := 0 N & 3 ; N = 1,2,3,4,1...
{
Case 1:
DllPath := "C:\WINDOWS\SYSTEM32\accessibilitycpl.dll"
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8)
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, ACCESSIBILITYCPL
DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
Return
Case 2:
DllPath := "C:\WINDOWS\SYSTEM32\compstui.dll"
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8)
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, COMPSTUI.DLL
DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
Return
Case 3:
DllPath := "C:\WINDOWS\SYSTEM32\comres.dll"
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8)
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, COMRES.DLL
DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
Return
Case 4:
DllPath := "C:\WINDOWS\SYSTEM32\ddores.dll"
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8)
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, DDORES.DLL
DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
}
Return
IconSizeToggle:
IconSize := !IconSize
GuiControl, -Redraw, ListView
LV_Delete()
if (IconSize)
ImageListID := IL_Create(1, 1, 1)
else
ImageListID := IL_Create()
LV_SetImageList(ImageListID, 1)
Loop { ; Populate the listview
Check := IL_Add(ImageListID, DllPath, A_Index)
if (Check != 0) {
LV_Add("Icon" . A_Index, A_Index)
}
else
Break
}
GuiControl, +Redraw, ListView
Return
I was able to figure this out. The full script is below. I would love if someone who actually knows what they are doing could edit this so the icon size only toggles when hitting the 'Toggle Icon Size' button rather than alternating every hotkey press. Otherwise, I think this is pretty much done...displays DLL/EXE names as headers, icons, and their corresponding numbers.