Не знаю, правильно ли я понял
!AutoIt Version: 3.3.6.0
Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $i = 0, $begin = 0
Global $iTimeSleep = 3 * 60 ; 3 Минуты
AdlibRegister('_Timetosleep', 180000)
AdlibRegister('_TrackingTimer', 1000)
$Form1 = GUICreate("", 243, 58, 348, 246, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$Button1 = GUICtrlCreateButton("Х", 8, 8, 227, 41, 0)
GUISetState()
Do
Until GUIGetMsg() = $Button1
Func _Timetosleep()
$i += 1
ConsoleWrite('> ' & $i & @CRLF)
If $i = 5 Then
$begin = TimerInit()
AdlibUnRegister('_Timetosleep')
EndIf
EndFunc ;==>_Timetosleep
Func _TrackingTimer()
If $begin > 0 And Round(TimerDiff($begin) / 1000) > $iTimeSleep Then AdlibRegister('_Timetosleep', 180000)
EndFunc ;==>_TrackingTimer