Tente isto:
#NoEnv
#SingleInstance Force
; equivalent to ALT+TAB (ALT+ESC cannot activate minimized windows)
F1::
List =
WinGet, AllWinsHwnd, List
Loop, % AllWinsHwnd
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetTitle, active_title, A
If CurrentWinTitle = %active_title%
continue
WinActivate, %CurrentWinTitle%
GoSub, MouseCenterInWindow
break
}
return
; SHIFT+ALT+TAB menu
F2::
List =
Menu, windows, Add
Menu, windows, deleteAll
WinGet, AllWinsHwnd, List
Loop, %AllWinsHwnd%
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetClass, CurrentWinClass, % "ahk_id " AllWinsHwnd%A_Index%
If CurrentWinClass = ApplicationFrameWindow
Continue
Menu, windows, Add, %CurrentWinTitle%%A_Tab%ahk_class %CurrentWinClass%, WinTitle
WinGet, Path, ProcessPath, % "ahk_id " AllWinsHwnd%A_Index%
Menu, windows, Icon, %CurrentWinTitle%%A_Tab%ahk_class %CurrentWinClass%, %Path%
}
Menu, windows, Show
return
WinTitle:
WinActivate, %A_ThisMenuItem%
GoSub, MouseCenterInWindow
return
MouseCenterInWindow:
CoordMode, Mouse, Relative
WinGetPos,,,Xmax,Ymax,A ; get active window size
Xcenter := Xmax/2 ; Calculate center of active window
Ycenter := Ymax/2
MouseMove, Xcenter, Ycenter
return