What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Solved] Need help for concatenating strings

[Solved] Need help for concatenating strings
Author: Message:
pauleeer
New Member
*


Posts: 2
Joined: Aug 2008
O.P. [Solved] Need help for concatenating strings
The problem is very stupid but I really can't find a solution.

My code is:
code:
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        ts = fso.OpenTextFile(filepath, 1); //filepath does not contains errors
        ssvar = "The file contains: \n\n";
        var line = ""; 
        while(!ts.AtEndOfStream)
        {       
             line = ts.ReadLine();       
             if (line != "")
             {       
                 ssvar = ssvar + line; //This WONT work, how to concatenate strings??
                 Debug.Trace(line); //THIS trace correctly fires the line's text
             }           
        }
        ts.Close();

        Debug.Trace(ssvar);//THIS trace WONT display anything but "The file contains: \n\n"

As you can see this code is a piece of cake.. but I really can't figure out why it simply doesn't work. I've tried with ReadAll function but that function won't even read the file. The file is in ASCII text format and is less than 1 KB. Does not contains strange characters.

Help me please :(

This post was edited on 08-31-2008 at 09:37 PM by pauleeer.
08-30-2008 11:52 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Need help for concatenating strings
What is the path you are passing to the function?

code:
var oFSO = new ActiveXObject('Scripting.FileSystemObject');

function ReadFile( filepath ) {
    if ( FileExists( filepath ) == true ) {
        var f = fso.OpenTextFile( filepath, 1 /* For_Reading */, false, (-2) /* TristateUseDefault  */ );
        return( f.ReadAll() );
    }
    return false;
}

function FileExists ( filepath ) { return oFSO.FileExists( filepath ); }

This post was edited on 08-31-2008 at 06:20 AM by matty.
08-31-2008 06:19 AM
Profile E-Mail PM Find Quote Report
pauleeer
New Member
*


Posts: 2
Joined: Aug 2008
O.P. RE: Need help for concatenating strings
Path was right but the file was written with a 00 byte at the beginning causing the program to read it wrong

Thanks for the help anyway! :D
08-31-2008 09:37 PM
Profile E-Mail 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