Option Explicit
If RunCountdown(30 * 60) Then CreateObject("WScript.Shell").Run """%programfiles%\Internet Explorer\iexplore.exe"" ""http://yandex.ru"""
Function CreateWindow()
' source http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
Dim sSignature, oShellWnd, oProc
On Error Resume Next
sSignature = Left(CreateObject("Scriptlet.TypeLib").GUID, 38)
Do
Set oProc = CreateObject("WScript.Shell").Exec("mshta about:""about:
""")
Do
If oProc.Status > 0 Then Exit Do
For Each oShellWnd In CreateObject("Shell.Application").Windows
Set CreateWindow = oShellWnd.GetProperty(sSignature)
If Err.Number = 0 Then Exit Function
Err.Clear
Next
Loop
Loop
End Function
Function RunCountdown(lSetTime)
Dim oWnd, sWndType, lInitTime, lRemain
RunCountdown = False
On Error Resume Next
Set oWnd = CreateWindow()
sWndType = TypeName(oWnd)
With oWnd
With .Document
.Title = "Countdown"
.Body.Style.Background = "buttonface"
.Body.Style.Font = "bold 60pt consolas, courier new"
.Body.InnerHTML = "
00:00
"
End With
.ResizeTo 350, 230
.MoveTo 400, 400
.ExecScript "window.Clicked=0;"
lInitTime = Timer()
Do
If sWndType <> TypeName(oWnd) Then Exit Function
Select Case .Clicked
Case 1
lInitTime = Timer()
.Clicked = 0
Case 2
.Close
Exit Function
End Select
lRemain = 86400 + lSetTime + lInitTime - Timer()
Do While lRemain >= 86400
lRemain = lRemain - 86400
Loop
If lRemain < 600 Then
.Output.InnerHTML = "0" & (lRemain \ 60) & ":" & Right("0" & lRemain Mod 60, 2)
Else
.Output.InnerHTML = (lRemain \ 60) & ":" & Right("0" & lRemain Mod 60, 2)
End If
WScript.Sleep 40
Loop While lRemain > 0
.Close
End With
RunCountdown = True
End Function