Shortcut to rotate between open windows

Discussion, questions and support.
Post Reply
TheRealMarshall
Posts: 4
Joined: Sep 18th, ’23, 22:54

Post by TheRealMarshall » Sep 30th, ’23, 20:53

I am looking for a shortcut that would have functionality similar to the Recent Files/Folders Menu shortcut, except it would only include my currently running applications. Its function would be the same as the functionality of ALT/Tab and would rotate between open windows. I need this because I am partially blind and use a screen reader, but I am having a problem where the screen reader is not reading me anything when I click alt-tab. So I am looking for a shortcut that would mimic the function, and give me that little popup that allows me to cycle through my running applications when I click the hotkey. Any help would be appreciated, thanks!
User avatar
Tom
Posts: 847
Joined: Nov 24th, ’15, 23:39

Post by Tom » Oct 2nd, ’23, 17:06

Try this (Type: Command):

Code: Select all

Menu, Windows, Add
Menu, Windows, deleteAll
WinGet windows, List
Loop %windows%
{
	id := windows%A_Index%
	WinGetTitle title, ahk_id %id%
	If (title = "")
		continue
	WinGetClass class, ahk_id %id%	
	If (class = "ApplicationFrameWindow") 
	{
		WinGetText, text, ahk_id %id%		
		If (text = "")
		{
			WinGet, style, style, ahk_id %id%
			If !(style = "0xB4CF0000")	 ; the window isn't minimized
				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
	Try 
		Menu, Windows, Icon, %title%, %Path%,, 0
	Catch 
		Menu, Windows, Icon, %title%, %A_WinDir%\System32\SHELL32.dll, 3, 0
}
Menu, Windows, Show
return

Activate_Window:
	SetTitleMatchMode, 3
	WinGetClass, Class, %A_ThisMenuItem%
	If (Class="Windows.UI.Core.CoreWindow") ; the minimized window has another class 
		WinActivate, %A_ThisMenuItem% ahk_class ApplicationFrameWindow
	else
		WinActivate, %A_ThisMenuItem%
return
Source: https://www.autohotkey.com/boards/viewtopic.php?t=74874
TheRealMarshall
Posts: 4
Joined: Sep 18th, ’23, 22:54

Post by TheRealMarshall » Oct 3rd, ’23, 16:02

Wonderful, this works great. Thank you!
Post Reply