Hi, i was in need of something that would shutdown the pc when the firefox download window closes, so here it is! Added some more functions but in essence, gives you a list of the windows available, their pid, handle and asociated exe.
choose the method of detection, PID, window handle or executable, choose item from the list, click 'select window', and go away, when the window closes, the pc will shutdown.
The reason why i included these 3 options is because the firefox download window is tricky, since it has an constantly updated title with the percentage changing, it becomes harder to retrieve the correct pid or handle, but with the exe option it works.
Note regarding firefox: Only works, if the only firefox window open is the downloads one, you can change in options, in order to keep it open and close automatically after the download is over.