HotKeySet("{F2}", "StopTYPE") Global $StopTYPE = False ;~ WinActivate("Notepad") WinActivate("Untitled - Notepad") While 1 Send("hi ") Sleep(500) If $StopTYPE Then ExitLoop WEnd Func StopTYPE() $StopTYPE = True EndFunc