Act When a Window Appears

I wrote this to autologin to my VMware vSphere Client. Every 500ms it checks to see if my window is open. If it finds a window that I’m interested in it acts, then waits for the window to close. I can easily add additional windows with more IF statements.