-
Notifications
You must be signed in to change notification settings - Fork 1
/
WriteFile.hta
executable file
·47 lines (35 loc) · 1.08 KB
/
WriteFile.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Expert - WriteFile</title>
<HTA:APPLICATION
APPLICATIONNAME = "Write File"
id="WriteFile"
name="WriteFile"
/>
<script language="vbscript">
Const ForWriting = 2
Dim objFSO, objFile, strFileName
strFileName = "textfile.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, 2, true)
Set objShell = CreateObject("WScript.Shell")
Sub Submitarea
sTxtarea = TextFile.Value
objFile.Write sTxtarea & vbCRLF
MsgBox "Your text has been added to " & strFileName, 64, "Textarea Input"
End Sub
Sub OpenTxtArea
ShellRun = objShell.Run ("%comspec% /c Start Notepad " & strFileName, 0, 1)
End Sub 'OpenTxtArea
</script>
</head>
<body>
<h1>Write File</h1>
<p>How to Write to a File.</p>
<textarea name="TextFile" id="TextFile" rows="5" cols="20">
</textarea>
<input type="button" value="Submit" onclick="Submitarea">
<input type="button" value="Open" onclick="OpenTxtArea">
</body>
</html>