AutoHotkey:列出所有打开的 windows
AutoHotkey: list all open windows
WinGet, OutputVar, List
可以得到所有未隐藏的列表windows。它显示的内容远远超过用户在 Windows 任务栏上可以看到的内容。
如何将 window 数字限制为任务栏上显示的数字。就像任务管理器中的简单列表一样。 (较少细节模式)
这是一种简单的方法,我不确定它的可靠性如何。
它通过尝试最小化 window 来工作,如果它被最小化则意味着它在任务栏上可用。
found/active 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
WinGet, OutputVar, List
可以得到所有未隐藏的列表windows。它显示的内容远远超过用户在 Windows 任务栏上可以看到的内容。
如何将 window 数字限制为任务栏上显示的数字。就像任务管理器中的简单列表一样。 (较少细节模式)
这是一种简单的方法,我不确定它的可靠性如何。
它通过尝试最小化 window 来工作,如果它被最小化则意味着它在任务栏上可用。
found/active 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