read text file

Posted by Pompey1 on Wed 26 Mar 2008 06:32 PM — 4 posts, 26,810 views.

#0
The "open" function suggests that it can be used for a world file or a text (.txt) file.

I have another app that writes data to a .txt file occasionally that I'd like to read into mushclient, but beyond the documentation for the open(filename) function I can't see anything to read lines, characters, whatever from the file.

Is the file just read in as a block of text to the variable specified eg:

var somevar = open(filename);

Pompey1
Australia Forum Administrator #1
You don't need a MUSHclient function to read a text file, Javascript will do that itself. I am not a big expert of Javascript, but a Google of "javascript open file" returned lots of examples.

An example might help, see this page:

http://www.gammon.com.au/forum/bbshowpost.php?id=1297

Scroll down to the Jscript part, that shows reading an entire file into a variable.
#2
Yeah, but I'm having problems getting the activex object for file handling to work under wine. I'll move the discussion to mushclient -> wine.

Pompey1
USA #3
Is there an issue with using the Notepad functions in MUSHclient to open the file into the notepad and rip all the information out of there using GetNotepadText? That's how I had been doing it for a while ago for a PK list.