如何在AutoHotkey中使用超过4个Case来创建DLL图标查看器的Switch语句?

huangapple go评论58阅读模式
英文:

How can I use more than 4 Cases in a Switch statement for creating a DLL Icons viewer in AutoHotkey?

问题

以下是您要翻译的内容:

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.


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 ```

<details>
<summary>英文:</summary>

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&#39;m trying to put together. I believe it&#39;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







</details>


# 答案1
**得分**: 1

这是一个自动化脚本,主要用于提取系统 DLL 和 EXE 文件的图标和图标编号。以下是代码中的注释和说明:

```plaintext
; ╞═══════════ Pre-Notes ═══════════╡
# Ctrl + T -  : 循环浏览各种 SYSTEM32 .dll 和 .exe 文件,并提取它们的图标和图标编号。

# 刷新脚本 ════  快速连续点击 Ctrl + HOME 键 2 次。(# TapCounts)
# 退出脚本 ════════  快速连续点击 Ctrl + Escape 键 3 次。(# TapCounts)

# 脚本更新器:在保存更改后自动重新加载脚本。
  - 如果对脚本文件进行任何更改并保存它,脚本将自动重新加载,无需手动干预。

# IndicateDots:显示位于托盘时钟上方的小彩色点的视觉/音频指示器,并发出声音,表示/验证正在采取的操作。
; ╞──────── Pre-Notes End ────────╡

上面是代码的一部分,包含一些说明和注释。如果您需要更多关于代码的翻译或有其他问题,请告诉我。

英文:

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.

/*
; ╞═══════════ Pre-Notes ═══════════╡ 
&#187; Ctrl + T -  : Cycles through various SYSTEM32 .dll and .exe files and extracts their icons and icon number.
&#187; Refresh Script ════  Ctrl + HOME key rapidly clicked 2 times. (# TapCounts)
&#187; Exit Script ════════  Ctrl + Escape key rapidly clicked 3 times. (# TapCounts)
&#187; Script Updater: Auto-reload script upon saved changes.
─ If you make any changes to the script file and save it, the script will automatically reload itself and continue running without manual intervention.
&#187; IndicateDots :  Visual/audio indicators displaying small colored dot just above tray clock and producing a soundbeep, indicating/verifying actions being taken.
; ╞──────── Pre-Notes End ────────╡ 
*/
; ╞═══════════ Auto-Execute ═══════════╡ 
Gosub, AutoExecute
; ╞──────── Auto-Execute End ────────╡ 
; ╞═══════════ Hotkey ═══════════╡ 
^T:: 	 ; ═════ (Ctrl + T) 
Gosub, IndicateDot1
Gui, Color, LIME 		 ; ←←← IndicateDot Color.
Gosub, IndicateDot2
; ╞────────  Hotkey End ────────╡ 
; ▎░░░░░░░▏ The Code ▏░░░░░░░▎ 
; ╞═══════════ Pre-Gui ═══════════╡ 
Gui, Color, 71B0DA  ; Soft Blue
Gui, Font, s12 w400 c0000A7  ; Deep Blue
Gui, Margin, 5, 5
Gui, 
+AlwaysOnTop 
;    -Caption 
-DPIScale 
+hwndGuiHwnd
-MinimizeBox 
+Owner
DllCall(&quot;uxtheme\SetWindowThemeAttribute&quot;, &quot;ptr&quot;, GuiHwnd, &quot;int&quot;, 1, &quot;int64*&quot;, 6 | 6&lt;&lt;32, &quot;uint&quot;, 8)
Gui, Add, Button, w170 h50 gIconSizeToggle +Center, ◈ Toggle Icon Size ◈
Gui, Add, Button, x+29 w100 h50 gRESET +Center, Restart`n↺  Script  ↻
; ╞────────  Pre-Gui End ────────╡ 
Switch n := n++ - max ? n : 1
{
Case 1: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\accessibilitycpl.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, ACCESSIBILITYCPL.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 2: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\compstui.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, COMPSTUI.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 3: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\comres.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, COMRES.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 4: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\ddores.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, DDORES.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 5: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\dmdskres.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, DMDSKRES.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 6: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\dsuiext.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, DSUIEXT.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 7: 
DllPath := &quot;C:\WINDOWS\explorer.exe&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, EXPLORER.EXE
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 8: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\ieframe.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, IEFRAME.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 9: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\imageres.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, IMAGERES.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 10: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\mmcndmgr.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, MMCNDMGR.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 11: 
DllPath := &quot;C:\WINDOWS\system32\mmres.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, MMRES.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 12: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\moricons.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, MORICONS.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 13: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\mstsc.exe&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, MSTSC.EXE
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 14: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\mstscax.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, MSTSCAX.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 15: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\netcenter.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, NETCENTER.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 16: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\netshell.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, NETSHELL.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 17: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\networkexplorer.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, NETWORKEXPLORER.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 18: 
DllPath := &quot;C:\WINDOWS\system32\pifmgr.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, PIFMGR.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 19: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\pnidui.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, PNIDUI.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 20: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\sensorscpl.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, SENSORSCPL.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 21: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\setupapi.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, SETUPAPI.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 22: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\shell32.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, SHELL32.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 23: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\wiashext.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, WIASHEXT.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 24: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\wmploc.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, WMPLOC.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 25: 
DllPath := &quot;C:\WINDOWS\SYSTEM32\wpdshext.dll&quot;
Gui, Add, ListView, x5 w300 h550 BackgroundE1E2E3 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, WPDSHEXT.DLL
DllCall(&quot;UxTheme.dll\SetWindowTheme&quot;, &quot;Ptr&quot;, ListViewHwnd, &quot;WStr&quot;, &quot;Explorer&quot;, &quot;Ptr&quot;, 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Return
Case 26: 
RELOAD 		 ; Reload script to start from cycle beginning.
}
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 {
Check := IL_Add(ImageListID, DllPath, A_Index)
if (Check != 0) {
LV_Add(&quot;Icon&quot; . A_Index, A_Index)
}
else
Break
}
; ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 
GuiControl, +Redraw, ListView
Gui, Show, x%xval% y%yval% 			 ; ←←← h600 w300,
OnMessage(0x0201, &quot;WM_LBUTTONDOWN&quot;) 	 ; ←←← Gui drag capability Pt. 1. after (Gui, Show).
Return
WM_LBUTTONDOWN() { 			 ; ←←← Gui drag capability Pt. 2. towards script end.
PostMessage, 0x00A1, 2, 0
}
GuiClose: 
Reload
; ▎░░░░░░░▏ The Code End ▏░░░░░░░▎ 
; ╞═══════════ Reload/Exit Routine ═══════════╡ 
RETURN
; ◦ ◦ ◦ ◦ ◦ ◦ ◦ RELOAD  SCRIPT ◦ ◦ ◦ ◦ ◦ ◦ ◦ 
^Home:: 		  ; ←←← (Ctrl + ([Home Button] x (# of TapCounts)))
if (A_TimeSincePriorHotkey &gt; 250) 
{
TapCount := 1
KeyWait, Esc
} else {
TapCount++
if (TapCount = 2) 	 ; ←←← Set TapCount to # of key taps wanted.
{
Gosub, IndicateDot1
Gui, Color, YELLOW 		 ; ←←← IndicateDot Color.
Gosub, IndicateDot2
Reload
} else {
KeyWait, Esc
}
}
Return
; ◦ ◦ ◦ ◦ ◦ ◦ ◦ EXIT SCRIPT ◦ ◦ ◦ ◦ ◦ ◦ ◦ 
^Esc:: 		; ←←← (Ctrl + ([Esc] x (# of TapCounts)))
if (A_TimeSincePriorHotkey &gt; 250) 
{
TapCount := 1
KeyWait, Esc
} else {
TapCount++
if (TapCount = 3) 	 ; ←←← Set TapCount to # of key taps wanted.
{
Gosub, IndicateDot1
Gui, Color, RED 		 ; ←←← IndicateDot Color.
Gosub, IndicateDot2
Gui, Destroy
ExitApp
} else {
KeyWait, Esc
}
}
Return
; ╞──────── Reload/Exit Routine End ────────╡ 
; ╞═══════════ Script Updater ═══════════╡ 
UpdateCheck: 				 ; Check if the script file has been modified.
oldModTime := currentModTime
FileGetTime, currentModTime, %A_ScriptFullPath%
; ◦ ◦ ◦ ◦ ◦ ◦ If the modification timestamp has changed, reload the script.
if  (oldModTime = currentModTime) Or (oldModTime = &quot;&quot;)
Return
Gosub, IndicateDot1
Gui, Color, BLUE 		 ; ←←← IndicateDot Color.
Gosub, IndicateDot2
Reload
; ╞──────── Script Updater End ────────╡ 
; ╞═══════════ Auto-Execute GoSub ═══════════╡ 
AutoExecute:
#SingleInstance, Force
#Persistent
SetBatchLines -1
DetectHiddenWindows, On
SetTimer, UpdateCheck, 500 ; Checks for script changes every 1/2 second. (Script Updater)
SetKeyDelay, 250 ; ←←← Set the tap delay time (milliseconds) for script Exit. (Tied to Reload/Exit routine)
Menu, Tray, Icon, wmploc.dll, 99 ; Local White Star tray Icon.
max := 26 
xval:=A_ScreenWidth-320 	 ; # of pixels from 
yval:=A_ScreenHeight-687 	 ; # of pixels from 
Return
; ╞──────── Auto-Execute Sub End ────────╡ 
; ╞═══════════ GoSubs ═══════════╡ 
RESET:
Reload
IndicateDot1:
Gui, Destroy
SysGet, MonitorWorkArea, MonitorWorkArea
SysGet, TaskbarPos, 4
Gui, +AlwaysOnTop -Caption +hwndHGUI +LastFound
Return
; ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 
IndicateDot2:
Gui, Margin, 13, 13 		 ; ←←← Dot Size.
Gui, Show, Hide
WinGetPos, , , WinWidth, WinHeight, ahk_id %HGUI%
NewX := MonitorWorkAreaRight - 80
NewY := MonitorWorkAreaBottom - WinHeight - 5
R := Min(WinWidth, WinHeight) // 1 	 ; ←←← Set value of cornering. (0.5=Oval, 0=square, 1= round, 5=rounded corners).
WinSet, Region, 0-0 W%WinWidth% H%WinHeight% R%R%-%R%
Gui, Show, x%NewX% y%NewY%
SoundGet, master_volume
SoundSet, 7
Soundbeep, 2100, 100
SoundSet, % master_volume
Sleep, 500
Gui, Destroy
Return
; ╞──────── GoSubs End ────────╡ 
; ╞──────────────────────────╡ 
; ╞═══════════ Script End ═══════════╡ 
; ╞──────────────────────────╡ 

huangapple
  • 本文由 发表于 2023年6月5日 04:38:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76402327.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定