i need to write a text area (box) value to .txt i am getting permissions denied when writing to "input.txt" i got got permission denied when writing input.txt from the text box. i edited using suggestions found below and also killed handle for input.txt using process explorer.
using the code below i can now save textbox text to text file input.txt. i also figured out how to call upon a batch file to change that text into a cyphered form, and then i added a refresh button to open that changed text into a second textbox as a final output result which leaves the text now capable of being password encrypted after being saved in input.txt and opened in a second textbox from file SR-Encrypted.txt after being cyphered via batch file encrypter.bat then by refreshing the page using the refresh button i added..
thank you agnar!
<html>
<script language="vbscript">
option explicit
Const ForWriting = 2
Dim objFSO, objFile, strFileName, objshell
strFileName = "input.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Sub Submitarea
Set objFile = objFSO.OpenTextFile(strFileName, 2, True)
objfile.Write TextFile.Value
objFile.Close
MsgBox "Your text has been added to " & strFileName, 64, "Textarea Input"
End Sub
</script>
</html>
</head>
<title>Example</title>
<script language="VBScript">
Sub test
set oFSO=CreateObject("Scripting.FileSystemObject")
set oFile=oFSO.OpenTextFile("SR-Encrypted.txt",1)
text=oFile.ReadAll
document.all.ScriptArea.value=text
Set objFile = nothing
oFile.Close
End Sub
</script>
</head>
<script language="vbscript">
Option Explicit
' This is the Sub that opens external files and reads in the contents.
' In this way, you can have separate files for data and libraries of functions
Sub Include(yourFile)
Dim oFSO, oFileBeingReadIn ' define Objects
Dim sFileContents ' define Strings
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFileBeingReadIn = oFSO.OpenTextFile("try.vbs", 1)
sFileContents = oFileBeingReadIn.ReadAll
oFileBeingReadIn.Close
ExecuteGlobal sFileContents
End Sub
' Here we call the Include Sub, then pass it the name of the file we want items from
Include "mySubLib"
</script>
<body>
<button onClick="test()">Refresh Message Encrypter-Decrypter</button>
</body>
</html>
</head>
</html>
<body>
<h1>Write File</h1>
<p>How to Write to a File.</p>
<textarea name="TextFile" id="TextFile" rows="20" cols="50"></textarea>
<input type="button" value="Submit" onclick="Submitarea">
</body>
<body>
</body>
</html>