Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Jscript ➜ read text file

read text file

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Pompey1   (12 posts)  Bio
Date Wed 26 Mar 2008 06:32 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 26 Mar 2008 08:50 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Pompey1   (12 posts)  Bio
Date Reply #2 on Thu 27 Mar 2008 02:20 AM (UTC)
Message
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
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Thu 27 Mar 2008 10:26 PM (UTC)
Message
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.

It is much easier to fight for one's ideals than to live up to them.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


21,275 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.