-
Notifications
You must be signed in to change notification settings - Fork 0
/
keep_alive.hta
101 lines (87 loc) · 2.97 KB
/
keep_alive.hta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<! D.Collins - 15:29 07/09/20075 >
<! Keeps computer alive >
<html>
<title>Keep Alive 1.1</title>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="Keep Alive"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
CONTEXTMENU="no"
ICON="search.ico"
INNERBORDER="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="yes"
SELECTION="no"
SCROLL="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="no"
SYSMENU="yes"
VERSION="1.1"
WINDOWSTATE="normal"
>
<head>
<SCRIPT LANGUAGE="VBScript">
Dim strAppName
Sub window_OnLoad
Window.resizeTo 240, 120
strScriptName = "KeepAlive.hta"
strAppName = oHTA.APPLICATIONNAME & " " & oHTA.VERSION
nmsecs.focus()
End Sub
Sub Go()
nmgo.disabled = True
nmsecs.disabled = True
KeepAlive()
End Sub
Sub KeepAlive()
If Not IsNumeric(nmsecs.value) Then
MsgBox nmsecs.value & " is not a valid entry. Please enter a whole number greater than zero.", vbExclamation + vbSystemModal, strAppName
nmgo.disabled = False
nmsecs.disabled = False
nmsecs.value = 60
nmsecs.focus()
Exit Sub
End If
If CDbl(nmsecs.value) <> Int(nmsecs.value) Or CDbl(nmsecs.value) <= 0 Then
MsgBox nmsecs.value & " is not a valid entry. Please enter a whole number greater than zero.", vbExclamation + vbSystemModal, strAppName
nmgo.disabled = False
nmsecs.disabled = False
nmsecs.value = 60
nmsecs.focus()
Exit Sub
End If
Set wshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{SCROLLLOCK}"
'# Wshshell.Popup "Sent CapsLock", 3,,vbSystemModal
iTimerID = window.SetTimeOut("KeepAlive()", nmsecs.value * 1000)
End Sub
Sub CheckforEnter()
If window.event.keyCode = 13 And nmgo.disabled = False Then
Go()
End If
End Sub
Sub KeyDown()
'# MsgBox window.event.keyCode
Select Case window.event.keyCode
Case 116 'F5
window.event.returnValue = false
window.event.keyCode = 0
Case 70 'Ctrl + F
If window.event.ctrlKey Then window.event.returnValue = false
Case 27 'Escape
Window.Close()
End Select
End Sub
</script>
<style>
body {font-size: 10pt; font-family: Arial; background-image:url(searchbackground.gif); background-color: buttonface; filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#4444FF', startColorstr='#FFFFFF', gradientType='0');}
.clsecs {font-size: 10pt; font-family: Ariel; background-color: white; width: 30; text-align: left; border-style: inset; border-width: 2px;}
.clgo {width: 100;}
</style>
</head>
<body onKeyDown='KeyDown()' onKeyPress='CheckforEnter()'>
Keypress frequency:   <input name="nmsecs" class="clsecs" value="60"/> secs.<br/><br/>
<center><button name="nmgo" class="clgo" onclick="Go()">OK</button></center>
</body>
</html>