Note that there are some explanatory texts on larger screens.

plurals
  1. POWrite to a text file using an HTA
    primarykey
    data
    text
    <p>I am trying to create an HTA file that allows a user to add data to a text file. I am fairly Inexperienced in the area.</p> <p>I need to accomplish a few things:</p> <ol> <li>Write the bit of data that is inputted to a text file (which my code does)</li> <li>Let the user chose from a drop-down list of available files to write to</li> <li>It would be nice if the data could be submitted onClick or by hitting Enter</li> <li>Clear the fields on submit</li> <li>Log every entry. No overwriting of data in the text file (my code overwrites)</li> </ol> <p>example:</p> <p>123<br> 456<br> 789<br></p> <p>I apologize if my code looks choppy. </p> <p>Any help or advice would be appreciated.</p> <p>Thank you.</p> <pre><code>&lt;html&gt;&lt;head&gt; &lt;SCRIPT LANGUAGE="VBScript"&gt; Sub Window_onLoad window.resizeTo 480,150 End Sub &lt;/SCRIPT&gt; &lt;script language="javascript"&gt; function Writedata() { var fso = new ActiveXObject("Scripting.FileSystemObject"); var write_id; write_id = document.getElementById('write_id').value ; alert('The data has been written to \n' + write_id); var s = fso.CreateTextFile(write_id, true); s.WriteLine(document.getElementById('name_id').value); s.Close(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Input: &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="name" value="" id="name_id"&gt;&lt;/td&gt; &lt;td&gt;&lt;select&gt;&lt;option name="write" value="C:\temp\test1.txt" id="write_id"&gt;Option1&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="button" onclick="Writedata()" value="submit"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload