How 2... Write a text file (as an interface)?

Help each other out

How 2... Write a text file (as an interface)?

Postby rbziggy on Sat Apr 02, 2005 3:57 pm

Not sure if this can be done from native XL or via a plugin. But in either case, having looked around, its not obvious how to do this... Let me explain...

I'd like to be able to write a text line out to a text file from within XL. I'd sort of envisaged there might be a command that:

- takes a file name (directory tree/name.txt)
- a text line (either directly or via a variable)

and would then (if the file does not exist) create the file and write the line of text to it OR (if the file does exist) just append the text line into the file as a new line.

Why do I want to do this?

- I have such interfaces on HA programmes. One does Text-To-Speech and the other is a HA control interface (ACE and the Comfort system for anyone familiar).
- I can also see it being useful as a logging application to keep track of anything you have been doing in XL.

I've been playing with Xevent recently and this pretty much does this type of thing except it uses one file (its own .ini file) and (my guess) expects it to exist. Interestingly, Xevent already seems to provide the other half of this interface in that if you write from an external proramme into the Xevent ini file you can get it to execute a XL command 'immediately'. So I was hoping the outbound half also existed.

Any ideas?

Thanks
rbziggy
 
Posts: 124
Joined: Mon Mar 21, 2005 11:49 pm
Location: UK

Postby lar282 on Sat Apr 02, 2005 5:54 pm

I do this in my plugin.Does this help?If so u can have the code

I take a filename from xlobby(from database) and delete a file
I take a filename and open that file and read all text(easy to change to write)

mail me if u wan the code
mailto:lasse10@telia.com
//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden