Open notepad and run the following code (it assumes you are using english windows and looks for the window title "Untitled").
loop { winget, pid, PID, Untitled ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt") tooltip, %ProcessHandle%, 1, 1 DllCall( "CloseHandle", "uint", ProcessHandle ) sleep, 1000 HotKey *5, KeyPress }
Notice that it prints one number, then waits for a second and writes another number. The numbers should be equal and are equal if you remove the following line:
HotKey *5, KeyPress