yes I’m a heathen using VBScript client side..Actually I’m fascinated by HTAs and am trying to use VBscript in one… Anyways.. The overall goal of this is to be able to write input to a txt file… I’m running into a error message “Object required” it’s pointing back to my FormContent variable I’m using to store the input information… I’m not sure whats going on here, I figure either A) I’m failing miserably B) I don’t properly understand how the value is being pulled C) I fail… (Also as a side note I will be addeding in validation later, so don’t bark at me :[ Any ideas on what’s going on?
<html>
<HTA:APPLICATION
APPLICATIONNAME="HerpDerp"></HTA:APPLICATION>
<head>
<meta content="en-us" http-equiv="Content-Language">
<!--Using VBscript to write data to file (create object, open, append, write, close). -->
<script type="text/vbscript">
Sub Submit_OnClick
dim filesys, filetxt, FormContent
Set FormContent = document.getElementById(Text1)
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("C:\\MyFile.txt", 8, True)
filetxt.WriteLine(FormContent.value)
filetxt.Close
End Sub
</script>
</head>
<form name="Form1">
<p><input name='Text1' style="width: 671px; height: 112px" type='text' id='Text1'></p>
<p><input name='Submit' style="width: 215px" type='button' value='Submit'></p>
</form>
</html>
Text1 is a string. You need to treat it as such (enclose it in quotes).
HOWEVER…. As a general suggestion, don’t use HTA. HTA is an antiquated set of technologies written over a decade ago and pretty much completely unmaintained by Microsoft.