https://www.labnol.org/software/tutorials/keep-window-always-on-top/5213/

!`:: ; Next window
    WinGetClass, ActiveClass, A
    WinGet, WinClassCount, Count, ahk_class %ActiveClass%
    if (WinClassCount = 1) ; or %ActiveClass% == ApplicationFrameWindow)
    {
        Return
    }    
    WinGet, List, List, % "ahk_class " ActiveClass
    Loop, % List
    {
        index := List - A_Index + 1
        WinGet, State, MinMax, % "ahk_id " List%index%
        if (State <> -1)
        {
            WinID := List%index%
            break
        }
    }
    WinActivate, % "ahk_id " WinID
    return