Just looking in the AHK Help manual, if you wanted to know which window was "active" (on top) at any given point, I
think (but I have not tried this) that the AHK command WinGet with the cmd parameter should be able to do it:
ID: Retrieves the unique ID number (HWND/handle) of a window. If there is no matching window, OutputVar is made blank. The functions WinExist() and WinActive() can also be used to retrieve the ID of a window; for example, WinExist("A") is a fast way to get the ID of the active window. To discover the HWND of a control (for use with Post/SendMessage or DllCall), use ControlGet Hwnd or MouseGetPos.
_____________________
Not sure if that is what you want though.
Otherwise, using AHK, you can get a specified window and make it
active - bring it to the top - or make it always
topmost with a toggle switch.