get_foreground_window
get_foreground_window(); - this function is used to get XHEWindowInterface interface to a window that has active user input. (available from version 7.0.39)
After testing, the function returns the result of its work to the script :
window interface – XHEWindowInterface interface to the specified window.