Autohotkey 自动热键:列出所有打开的窗口
Autohotkey 自动热键:列出所有打开的窗口,autohotkey,Autohotkey,WinGet、OutputVar、List可以获取所有未隐藏窗口的列表。它显示的方式比用户在Windows任务栏上看到的要多 如何将窗口数限制为任务栏上显示的窗口数。就像任务管理器中的简单列表一样。(更少的细节模式)这里有一个简单的方法,我不确定它有多可靠。 它的工作原理是尝试最小化窗口,如果窗口最小化,则表示它在任务栏上可用。 您可以以任何形式获得已找到/活动窗口的列表,这里我使用数组 getWindows: activeWindowsId := [] activeWindowsExe :=
WinGet、OutputVar、List
可以获取所有未隐藏窗口的列表。它显示的方式比用户在Windows任务栏上看到的要多
如何将窗口数限制为任务栏上显示的窗口数。就像任务管理器中的简单列表一样。(更少的细节模式)这里有一个简单的方法,我不确定它有多可靠。
它的工作原理是尝试最小化窗口,如果窗口最小化,则表示它在任务栏上可用。
您可以以任何形式获得已找到/活动窗口的列表,这里我使用数组
getWindows:
activeWindowsId := []
activeWindowsExe := []
newlist := ""
WinGet, List, List ;get the list of all windows
Sendinput, #m ;mimimize all windows by using the windows shortcut win+m
sleep, 200
;Loop % List ;or use this loop to minimze the windows
;{
; WinMinimize, % "ahk_id " List%A_Index%
;}
Loop % List
{
WinGet, theExe, ProcessName, % "ahk_id " List%A_Index% ;get the name of the exe
WinGet, windowState, MinMax, % "ahk_id " List%A_Index% ;get the state of the window, -1 is minimized, 1 is maximized, 0 is neither
if (windowState == -1) ;if the window is minimized
{
activeWindowsId.push(List%A_Index%) ;add the window id (hwnd) to this array
activeWindowsExe.push(theExe) ;add the window exe to this array
WinRestore, % "ahk_id " List%A_Index% ;restore the window
}
}
;read the found active windows list from the array to a string and show it with a msgbox
For index, exe in activeWindowsExe
{
newList .= exe "`n"
}
msgbox, % newList
return
请参见结尾的示例-简而言之,它们检查是否存在标题栏样式。