This is a Pause function designed to work with a button on gui, will not work with a hotkey too (as is). Main thing to remember about this one is to add your button ID in the pause loop, where the one below is "$hPause" HotKeySet("{Esc}", "_Exit") $hGui = GUICreate("Gui Pause Button Example", 300, 80) $hPause = GUICtrlCreateButton("Pause", 120, 24, 60) GUISetState() Global $Counter = 0 ; Not needed, just for demonstration purpose. While 3 ;Your code starts in this main loop ; Note that