I make a mistake/error in my example (post #31) There should be: Func CloseAlert() Sleep(3000) ControlClick("[CLASS:#32770]", "Someone clicked the document!", "[CLASS:Button; INSTANCE:1]") EndFunc ;==>CloseAlert But even that fix is not able to properly close the window. but ...... Yesterday @Chimp @Jos an me discused here:     and here is working solution for HOW TO CLICK IN JAVA ALLERT WINDOW ;~ https://www.autoitsc