However, it filters out windows that do not have a title bar. This is a good thing and a bad thing. A good thing because it filters out things like the Nvidia Overlay and other invisible background apps, but it's a bad thing because it also filters out things I do want, like fullscreen games running in the background.
I'm wondering if there's a way to modify this code to show a proper list of apps as it shows properly in the alt+tab window or as displayed in the windows task bar. If this is a limitation of AHK and not possible, please let me know.
Bonus question: I'm also looking for a way to filter out items from the list that have a specific window title.
Code: Select all
#SingleInstance, Ignore
#NoTrayIcon
OnExit, ExitSub
Try
{
Menu, Windows, Add
Menu, Windows, deleteAll
WinGet windows, List
Loop %windows%
{
Menu, Windows, Add, Open Windows Task View..., Activate_Taskview
Menu, Windows, Icon, Open Windows Task View..., %A_ScriptDir%\TaskView.ico,, %3%
id := windows%A_Index%
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
If (class = "ApplicationFrameWindow")
{
WinGetText, text, ahk_id %id%
If (text = "")
continue
}
WinGet, style, style, ahk_id %id%
If !(style & 0xC00000) ; if the window doesn't have a title bar
{
; If title not contains ... ; add exceptions
continue
}
WinGet, Path, ProcessPath, ahk_id %id%
Menu, Windows, Add, %title%, Activate_Window
If (class = "ApplicationFrameWindow")
Menu, Windows, Icon, %title%, %A_WinDir%\System32\SHELL32.dll, 3, 0
else
Menu, Windows, Icon, %title%, %Path%,, %3%
}
Menu, Windows, Show, %1%, %2%
return
Activate_Taskview:
SetStoreCapsLockMode, Off
Send, #{Tab}
Run, "%PROGRAMFILES%\Rainmeter\Rainmeter.exe" !Update "Droptop\BackgroundProcesses"
return
Activate_Window:
SetTitleMatchMode, 3
WinActivate, %A_ThisMenuItem%
Run, "%PROGRAMFILES%\Rainmeter\Rainmeter.exe" !Update "Droptop\BackgroundProcesses"
return
}
ExitSub:
Run, "%PROGRAMFILES%\Rainmeter\Rainmeter.exe" !UpdateMeasure IsFull "Droptop\BackgroundProcesses"
ExitApp