I'm trying to create an equivalent of a HTA timer I found some months back. I've revised the code below to fit my needs with HTA (though the 10 seconds part is only to show that it works in a quick fashion).
Here's my question:
Is it possible to get a .vbs equivalent? I don't need a GUI (so no HTA), but would rather like the code to run in the background and repeat itself every 5 minutes (it would serve as a reminder system for myself). I haven't seen any examples of this on experts-exchange (I've searched keywords of 'countdown' and 'timer' and found no such luck for an actual .vbs file).
Can anyone help? Thanks!
Here's the HTA code. I tried several variations, but I can't figure out how to loop a timer for just vbs.
Here's my question:
Is it possible to get a .vbs equivalent? I don't need a GUI (so no HTA), but would rather like the code to run in the background and repeat itself every 5 minutes (it would serve as a reminder system for myself). I haven't seen any examples of this on experts-exchange (I've searched keywords of 'countdown' and 'timer' and found no such luck for an actual .vbs file).
Can anyone help? Thanks!
Here's the HTA code. I tried several variations, but I can't figure out how to loop a timer for just vbs.
Code:
<html>
<head>
<title>Test HTA</title>
<HTA:APPLICATION
APPLICATIONNAME="Test HTA"
BORDER="thin"
SCROLL="yes"
SINGLEINSTANCE="no"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Declare global variable outside the Subs
Dim intMinutes
Dim intSeconds
Sub Window_onLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
intMinutes = 1
intSeconds = 0
iTimerID = window.setInterval("CloseWindow", 1000)
End Sub
Sub CloseWindow
If intSeconds = 0 Then
If intMinutes = 0 Then
msgbox "This message will repeat in another 10 seconds"
Else
intMinutes = intMinutes - 1
End If
intSeconds = 10
Else
intSeconds = intSeconds - 1
End If
span_clock.innerHTML = intMinutes & ":" & Right("00" & intSeconds, 2)
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align="center" colspan="2">
<h2>Test HTA</h2>
</td>
</tr>
<tr>
<td align='center'>
<input type='button' value='Close' name='btnClose' id='btnClose' onClick='vbs:window.close'>
</td>
</tr>
<tr>
<td>
<span id="span_clock">
0:10
</span>
</td>
</tr>
</table>
</body>
</html>