What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Reading text file problem...

Reading text file problem...
Author: Message:
Xocide
New Member
*


Posts: 2
35 / Male / –
Joined: Apr 2007
O.P. Reading text file problem...
Hi, I'm trying to make a script that reads from a text file that the script created itself, However whenever it reads a file all I get is:
quote:
˙ūt

Here is the code I'm using to read it:
code:
            var thetxtFile = '';
            var Message = '';
            var TheFile = 'test';
            FSO = new ActiveXObject("Scripting.FileSystemObject");
            if (FSO.FileExists(MsgPlus.ScriptFilesPath + "\\txtFiles\\" + TheFile + ".txt")) {
                    thetxtFile = FSO.OpenTextFile(MsgPlus.ScriptFilesPath + "\\txtFiles\\" + TheFile + ".txt", 1);
                Message = thetxtFile.ReadAll();
                Debug.Trace(Message);
            }


the file test.txt contains "test" in it.

This post was edited on 04-27-2007 at 07:40 PM by Xocide.
04-27-2007 07:40 PM
Profile PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
RE: Reading text file problem...
quote:
Originally posted by Xocide
Hi, I'm trying to make a script that reads from a text file that the script created itself, However whenever it reads a file all I get is:


Here is the code I'm using to read it:
code:
            var thetxtFile = '';
            var Message = '';
            var TheFile = 'test';
            FSO = new ActiveXObject("Scripting.FileSystemObject");
            if (FSO.FileExists(MsgPlus.ScriptFilesPath + "\\txtFiles\\" + TheFile + ".txt")) {
                    thetxtFile = FSO.OpenTextFile(MsgPlus.ScriptFilesPath + "\\txtFiles\\" + TheFile + ".txt", 1);
                Message = thetxtFile.ReadAll();
                Debug.Trace(Message);
            }


the file test.txt contains "test" in it.

Hey Welcome on this forum!Please search before post next time;)...To solve your problem see TheGuRuSupremacy answer to How to read a text file
04-27-2007 07:47 PM
Profile PM Find Quote Report
Xocide
New Member
*


Posts: 2
35 / Male / –
Joined: Apr 2007
O.P. RE: RE: Reading text file problem...
quote:
Originally posted by TheGuruSupremacy
Hey Welcome on this forum!Please search before post next time;)...To solve your problem see TheGuRuSupremacy answer to How to read a text file


May I suggest you read, and test the code next time?
Where do you think I found the code to read a file?
04-27-2007 07:58 PM
Profile PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Reading text file problem...
I have really no idea.. But Message could be a javascript array of the lines.

Also, try to change:
code:
var thetxtFile = '';
var Message = '';
var TheFile = 'test';
To:
code:
var thetxtFile = "";
var Message = "";
var TheFile = "test";

Edit: Now when I look at it it might be a unicode problem, but I don't see why, and cannot help you with that sorry.

This post was edited on 04-27-2007 at 08:03 PM by vikke.
4 8 15 16 23 42
04-27-2007 08:02 PM
Profile E-Mail PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
RE: Reading text file problem...
quote:
Originally posted by Xocide
May I suggest you read, and test the code next time?
Where do you think I found the code to read a file?

I'm so sorry...You are right...However the code i(and you) have posted WORKS FINE for me...I don't know why it doesn't work for you
04-27-2007 10:00 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Reading text file problem...
It is because the file is unicode not ansi.

Eljay's reply to unicode problem
04-27-2007 10:28 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Reading text file problem...
quote:
Originally posted by Matty
It is because the file is unicode not ansi.

Eljay's reply to unicode problem
Although that code still has some major bugs. And as such shouldn't be used just like that without understanding the problems and major limitations it has.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-28-2007 03:25 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On