#include "GlobalEvents.au3" Local $hGUI, $hLabel, $hInput, $sPassword = "1234" ; Trigger Test1 when $hGUI receives a value. And trigger only once. _GlobalEvents_Create("$hGUI", Test1) ; Trigger Test2 when the right password was entered, exit the script from the event. ; Pass some arguments :) _GlobalEvents_Create("GuiCtrlRead($hInput) == $sPassword", Test2, 0, MouseGetPos()) $hGUI = GUICreate("", 175, 50) $hLabel = GUICtrlCreateLabel("Enter your password (1234)!", 0, 5, 175, 15, 1) $hInput = GUICtrlCreateInput("", 5, 25, 165, 20, 1) GUISetState() While GUIGetMsg() <> -3 WEnd ; Event handler 1 Func Test1() MsgBox(0, "Event Test1", "GUI was created!") EndFunc ; Event handler 2 Func Test2($aCoords) GUIDelete($hGUI) Exit MsgBox(0, "Event Test2", "The password was correct!" & @CRLF & @CRLF & "BTW: Your mouse coordinates are " & $aCoords[0] & ":" & $aCoords[1] & "!") - 1 EndFunc