Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

439
Views
Web application - Write To .txt file with Javascript FileObject.Write

I'm trying to re-purpose some older java script code that I use in order to create a text file via an intranet web app. The following code creates text files that are picked up and processed by a third party application running on the same device...

<script>
    function WriteTransferFile(location) {
        var fileSystemObject = new ActiveXObject("Scripting.FileSystemObject");
        var fileObject = fileSystemObject.CreateTextFile("C:\\transfer\\transfer.txt", true);
        fileObject.Write(location);
        fileObject.Close();
        return location;
    }
</script>

<script id="writetransfer">
    function writetransfer() {
        var Location = document.getElementById('lblCommand');
        var Command = Location.innerHTML;
        WriteTransferFile(Command);
        }
</script>

This works fine for a single text string to be pasted into a text file, but I now need to create a file which takes 4 different fields from the web page and writes them on to consecutive lines. I've played around with the above but any attempt to add a second line of text overwrites the first line instead creating a new one below it. Desired output...

Field 1

Field 2

Field 3

Field 4

Any ideas how I might accomplish this?

I'm aware this probably isn't the sleekest solution, but there are no concerns regarding the suppression of active X security settings as this is for a closed system with access to local intranet only.

Thanks

Steve

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!