Subj : Writing to a text file
To : All
From : Lab Rat
Date : Thu Feb 06 2014 11:55 pm
Hi all,
Unfortunately, Javascript isn't my first (programming) language and I'm
struggling to get to grips with creating a simple plain text file from a
script. I've spent hours staring at the JS Object Model Reference
(
http://synchro.net/docs/jsobjs.html) and I just cannot work it out.
This is what I've got so far:
var f = new File('test.txt');
file.open('w');
file.writeln('Line 1');
file.writeln('Line 2');
file.close();
I've tried the file.open(file_exists(file.name) ? 'r+':'w+'); line mentioned
in the documentation and I just cannot get this to work.
Any code suggestions would be welcome!
Thanks,
Lab Rat.
---
� Synchronet � Toxic Laboratory BBS - Birmingham, UK - toxicbbs.com