ВО! такой вариант работает по нажатию на горячую клавишу (Ctrl S), почему же событие не срабатывает при нажатии на кнопку?
Код:

Opt("GuiOnEventMode", 1)
#include <GUIConstants.au3>
HotKeySet("^s", "SetExitLoop")
Global $ExitLoop, $Mark = 10
$gui = GUICreate("Abort GUI", 420, 140, -1, -1, $WS_SIZEBOX)
$Button = GUICtrlCreateButton("Start", 180, 20, 70)
GUICtrlSetOnEvent($Button, "Button")
GUISetOnEvent(-3, "ExitScript")
$Progress = GUICtrlCreateProgress(60, 60, 300, 15)
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Button()
GUICtrlSetData($Button, "Abort")
While $ExitLoop = 0
For $i = $Mark To 100
If $i = 100 Then $i = 0
GUICtrlSetData($Progress, $i)
If $ExitLoop = 1 Then
$Mark = $i
ExitLoop
EndIf
Sleep(10)
Next
WEnd
GUICtrlSetData($Button, "Start")
$ExitLoop = 0
EndFunc
Func SetExitLoop()
$ExitLoop = 1
EndFunc
Func ExitScript()
Exit
EndFunc