Если по проще, то вот:
Код:
Global $subject = "Заголовок", $sms = "Проверка"
Global $Wait = 10
Global $smsWinTitle = "Оповещение SMS"
Global $smsMessage = _
'Тема: ' & $subject & @CRLF & 'Сообщение: ' & $sms & @CRLF & 'Время до отправки SMS: %s' & @CRLF & _
'сек. ' & @CRLF & @CRLF & 'Нажмите Отмена, если Вы НЕ хотите получить эту СМС'
$isSend = _MsgBoxTimer(1, $smsWinTitle, $smsMessage, $Wait)
Func _MsgBoxTimer($iFlag, $sTitle, $sText, $iMBTimeOut = 0, $hWnd=0)
Local $hFile, $sMBLine, $sSet_Text, $iRet
$sSet_Text = StringReplace($sText, @CRLF, '\n')
$sMBLine = '#NoTrayIcon' & @CRLF
$sMBLine &= 'Opt("WinWaitDelay", 1)' & @CRLF
$sMBLine &= 'While Not WinExists("' & $sTitle & '")' & @CRLF
$sMBLine &= ' Sleep(10)' & @CRLF
$sMBLine &= 'WEnd' & @CRLF
$sMBLine &= 'ControlSetText("' & $sTitle & '", "", "Static1", StringFormat("' & $sSet_Text & '", ' & $iMBTimeOut & '))' & @CRLF
If $iMBTimeOut > 0 Then
$sMBLine &= _
'$TimerInit = TimerInit()' & @CRLF & _
'$iTime = ' & $iMBTimeOut & @CRLF & _
'While $iTime > 0' & @CRLF & _
' ControlSetText("' & $sTitle & '", "", "Static1", StringFormat("' & $sSet_Text & '", $iTime))' & @CRLF & _
' If Not WinExists("' & $sTitle & '") Then ExitLoop' & @CRLF & _
' Sleep(1000)' & @CRLF & _
' $iTime -= 1' & @CRLF & _
'WEnd'
EndIf
$hFile = FileOpen(@TempDir & '\MiscMMB.tmp', 2)
FileWrite($hFile, $sMBLine)
FileClose($hFile)
Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\MiscMMB.tmp"')
$iRet = MsgBox($iFlag, $sTitle, StringFormat($sText, $iMBTimeOut), $iMBTimeOut)
While FileExists(@TempDir & '\MiscMMB.tmp')
FileDelete(@TempDir & '\MiscMMB.tmp')
WEnd
Return $iRet
EndFunc
|