i was searching for that script in this forum, but it seems to be lost or removed?
that script was kinda using activex or vbscript
it writes a .txt or a file to be saved to a location in the hard disk...
(it's not server-side)...can anyone repost that script?
Will you be using an hta file to do this or will you be using a web page on the net somewhere? Its not possible to do this through a normal browser. Why are you wanting to create the text file in the first place?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
that post you are talking about was one of my posts, lol.
lemme find it and i will re-post it.
using such a script, you must run it through a hta file (hyper text application) or something similar.
I have the VBscript version of it.....
Code:
<html>
<head></head>
<body>
<textarea id=textA rows=7 cols=60></textarea>
<input type=button value="write to file" name=Btn>
</body>
</html>
<script type=text/javascript>
function doit(){
return document.getElementById('textA').value;
}
</script>
<script language=VBscript>
Option Explicit
Dim objFSO, objFolder, objTextFile, objFile
Dim strDirectory, strFile, strText, f
Dim folfiles, fil, folder, i
Sub Btn_OnClick
strDirectory = "C:\folder\folder\"
strFile = "\filename.txt"
strText = doit()
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
If strText = "False" then
MsgBox "Please fill in all fields before writing data to Database."
Else
' Check that the strDirectory folder exists
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Set folfiles = objFolder.Files
Else
f = split(strDirectory, "\")
for i=0 to UBound(f)
if i=0 then folder = f(i) else folder = folder & "\" & f(i)
if not objFSO.FolderExists(folder) then objFSO.CreateFolder(folder)
next
End If
If objFSO.FileExists(strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
End If
set objFile = nothing
set objFolder = nothing
Const ForAppending = 8
Const ForWriting = 2
Const ForReading = 1
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForAppending, True)
' Writes strText every time you run this VBScript
objTextFile.WriteLine(strText)
objTextFile.Close
End If
End Sub
</script>
all the things higlighted are the parts you will need to change depending on wher ethe file is , what the files name is, and what you want to do to the file i.e. read from it, over write it, or append to it.
__________________
I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.
typing some text and processing it using javascript, then i want to allow it to save it for backup purposes...
yes, it's possible, i once tried a code posted here, it works in creating a external text file saved locally on hard disk...
i can't find this script here anymore.....
btw, i'm working locally in my pc, client-side only!
Through a normal browser its not possible without getting any kind of security warnings. The fact that you are trying to do this worries me a little seeing as how you will be messing with users systems. Don't take on more than you can chew. If you can't code something yourself then don't do the project simple as that.
On a lighter note here is the thread that says how to do it using JS in an HTA file. I repeat an HTA file which is NOT a normal web browser.
thanx guys....
btw, it was your post aerospace, i even added a response there...
since i only code using javascript, then copy pasting some processed text can be a hassle, that's the reason i prefer a one button save!