obsidian/笔记文件/2.笔记/同类窗口切换.md
2025-03-26 00:02:56 +08:00

1012 B

#ahk

!u::
Gui, Destroy
	Gui +AlwaysOnTop
	counter:=0
	WinGet, vWinList, List, ahk_class UnityContainerWndClass
	has = 0
	Loop, %vWinList%
	{
		hWnd := vWinList%A_Index%
		has := 1
		WinGetTitle, title, ahk_id %hWnd%
		Gui Add, Button, gChoiceRider,%hWnd%,%title%

	} 

	if (has == 1)
	{
		Gui, Show, AutoSize Center
	}
Return

ChoiceUnity:
	text = %A_GuiControl%
	Loop, Parse, text, `,
	{
		WinGetTitle, title, ahk_id %A_LoopField%
		WinActivate,ahk_id %A_LoopField%
		break
	}
	Gui, Destroy
Return

!r::
Gui, Destroy
	Gui +AlwaysOnTop
	WinGet, vWinList, List, ahk_class SunAwtFrame
	has = 0
	Loop, %vWinList%
	{
		hWnd := vWinList%A_Index%
		has := 1
		WinGetTitle, title, ahk_id %hWnd%
		Gui Add, Button, gChoiceRider,%hWnd%,%title%

	} 

	if (has == 1)
	{
		Gui, Show, AutoSize Center
	}

Return

ChoiceRider:
	text = %A_GuiControl%
	Loop, Parse, text, `,
	{
		WinGetTitle, title, ahk_id %A_LoopField%
		WinActivate,ahk_id %A_LoopField%
		break
	}
	Gui, Destroy
Return

!Esc::
Gui, Destroy
Return