-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial_04.hta
More file actions
42 lines (36 loc) · 954 Bytes
/
tutorial_04.hta
File metadata and controls
42 lines (36 loc) · 954 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title> </title>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<hta:application id="mainapp"
applicationName="Tutorials"
contextMenu="no"
icon="explorer.exe"
selection="no"
singleInstance="yes"
version="1.0"
/>
<script>
// window setup
window.resizeTo(500,300)
var xpos = (screen.width - window.outerWidth) / 2
var ypos = (screen.height - window.outerHeight) / 2
window.moveTo(xpos, ypos)
// functions
function runCommand(command) {
var wss = new ActiveXObject('WScript.Shell')
wss.run(command)
}
function onEnter(k, text) {
if (k.keyCode == 13) {
runCommand(text)
}
}
</script>
</head>
<body>
<input type="text" id="userInp" onkeypress="onEnter(event, this.value)" />
<input type="button" onclick="runCommand(userInp.value)" value="Run this text">
</body>
</html>