While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1 ; Значение возвращенное ф-цией GUICtrlCreateButton()
$iPid = Run('...')
$hTimer = TimerInit()
Case $GUI_EVENT_CLOSE ; При закрытии окна
Exit
EndSwitch
If IsDeclared( "hTimer" ) And TimerDiff( $hTimer ) >= 2 * 60 * 60 * 1000 Then ;2 часа
ProcessClose( $iPid )
MsgBox( 64, "Title", "Тесты успешно завершены!" )
EndIf
WEnd