Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Count down timer

13 views
Skip to first unread message

Byron

unread,
Jun 18, 2007, 2:51:04 PM6/18/07
to
How do i create a msgbox popup in the middle of my screen that displays an
active count down

for example "this pc will shutdown in 10 9 8 7 etc"
I have figured out the shutdown portion of this script, just can seem to
figure out the timer.

Thanks

S Moran

unread,
Jun 18, 2007, 4:14:03 PM6/18/07
to
the "shutdown" command already does this if you pass it the number of
seconds to wait

"Byron" <start...@shaw.ca> wrote in message
news:%23naVnmd...@TK2MSFTNGP06.phx.gbl...

ItsMillerTime4u

unread,
Jun 18, 2007, 5:11:16 PM6/18/07
to
The only other way to do this is to instead of a MsgBox, use an HTA
that has its inner text change as it counts down. Usually you would
have the main text, and then have a div for the number field, and then
as you count down you just dynamically change the number in the div
until 0 is met. I have some example code if need it See below:

<HTML>
<HEAD>
<TITLE>TIMER</TITLE>
<SCRIPT LANGUAGE="VBSCRIPT">
maxTime = 10
Sub Window_OnLoad()
x=1
For a = (objTable.Rows.Length -1) to 0 Step -1
myNewRow = document.all.objTable.deleteRow(a)
Next
Set objRow = objTableBody.InsertRow()
objRow.Style.fontSize = "12px"
Set objCell = objRow.InsertCell()
timeLeft = maxTime - x
If timeLeft = 0 Then Reboot()
objCell.InnerText = TimeLeft
x=x+1
Sleep(1)
Loop
End Sub

Function Sleep(x)
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%COMPSPEC% /c ping -n " & 1+x & " 127.0.0.1>nul", 0, 1
End Function
</SCRIPT>
</HEAD>
<BODY>
Countdown Timer:
<CENTER>
<TABLE ID="objTable" border="0" bgcolor="ThreeDHighlight">
<TBODY ID="objTableBody"></TBODY>
</TABLE>
</CENTER>
</BODY>
</HTML>

0 new messages