在两个窗口之间切换, 代替alt+tab方式,本脚本只是在最近两个窗口之内切换,简单快捷,常用。

 

/*
	------------------------------------------------------
	Filename:		在两个窗口之间切换.ahk
	Description:		代替alt+tab方式,本脚本只是在最近两个窗口之内切换,简单快捷,常用。
	Version:		2020年1月10日13:03:39
	Created By:		sunwind
	Type:			AutoHotkey
	------------------------------------------------------
	------------------------------------------------------
*/

#Persistent
SetTimer, Alert1, 500
WindowList:=[]
return

Alert1:
	Value := WindowList.Pop()
	if (Value=WinExist("A"))
	{
		WindowList.push(WinExist("A"))
	}
	else
	{
		if (value!="")
			WindowList.push(Value)
		WindowList.push(WinExist("A"))
	}
return

;最近两个窗口切换!!好用
#z::
Value:=WindowList[WindowList.Length()-1]
IfWinNotExist,ahk_id  %Value%
{
	WindowList.RemoveAt(WindowList.Length()-1)
}

WinActivate,ahk_id  %Value%

return