Taken straight from the wiki managing multiple gui's but added a loop in _GUI2 function It demonstrates a problem I'm stuck at, where I need an extra loop to keep my script from wandering off beyond my control and failing. Anyway, the following will not work. #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $hGUI2, $hButton2 ; Predeclare these variables gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Main") ; R