Код:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $WAIT_1 = 2 ; 2 секунды
Global $WAIT_2 = 3 ; 3 секунды
$nForm1 = GUICreate("", 363, 196, 577, 289, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
$Button1 = GUICtrlCreateButton("X", 136, 48, 91, 89)
GUISetState(@SW_SHOW)
$iBegin_1 = TimerInit()
$iBegin_2 = TimerInit()
Do
$nMsg = GUIGetMsg()
If Round(TimerDiff($iBegin_1) / 1000) = $WAIT_1 Then
Send("{1}")
$iBegin_1 = TimerInit()
EndIf
If Round(TimerDiff($iBegin_2) / 1000) = $WAIT_2 Then
Send("{2}")
$iBegin_2 = TimerInit()
EndIf
Sleep(200)
Until $nMsg = $Button1 Or $nMsg = $GUI_EVENT_CLOSE