What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP : Need a solution to load messages to jscript.

HELP : Need a solution to load messages to jscript.
Author: Message:
Saki
New Member
*


Posts: 6
Joined: Apr 2009
O.P. Happy  HELP : Need a solution to load messages to jscript.
Hello everyone

I am new for jscript, I am developing a program (script) to send a auto message to my friends, whom stay online for too long. I mean, I will notice them for take a little break from computer online.

Now my script almost complete just left in a part of load data (nice and worm messages) for send it out.

I try to search for this solution for a week but still no exactly I want.

In my idea, I think to prepare messages in local XML file (same directory of the script), then open and load it to script array, then random select them to send out. I looking the way to do this work.

I hope will has someone show me an answer in a sample XML file that contain messages. Also a script to load and random select their message in array to display.

Thank you so much for your help.
Sakpong (Thailand)

ps. I also attached my (modified) script. In case you need to understand more in my idea.
Dear everyone

I'm looking in Tips's topic(http://shoutbox.menthix.net/showthread.php?tid=56747). I feel I am found a solution (Reading the contents of a file) in there. It's seem not to hard. Next I must separate it to array.
I will try to implement it and will tell the result soon.

Sorry to annoy you. The solution is seem to very closely but I am looking in wrong places.

But if someone have any good suggestions, please. I always open for your opinion.

Thank you so much.

.plsc File Attachment: Care 4 Friends.plsc (6.57 KB)
This file has been downloaded 108 time(s).

This post was edited on 04-30-2009 at 09:52 AM by Saki.
04-30-2009 06:53 AM
Profile E-Mail PM Find Quote Report
Saki
New Member
*


Posts: 6
Joined: Apr 2009
O.P. RE: HELP : Need a solution to load messages to jscript.
Dear everyone

This problems are still on.  :(

I try (some tips from http://shoutbox.menthix.net/showthread.php?tid=56747&page=1)

    code :
    var msgFile    = MsgPlus.ScriptFilesPath+"\\Messages.xml";
    function file_exists(file)
    {
       return new ActiveXObject("Scripting.FileSystemObject").FileExists(file);
    }
    -----------------------------------------------------------------------------------

and

    code :
    -----------------------------------------------------------------------------------
    function get_file_contents(file)
    {
        var fileSys = new ActiveXObject("Scripting.FileSystemObject");
        var fileH = fileSys.OpenTextFile(file, 1, 0);
        var text = fileH.ReadAll();
        fileH.close();
        return text;
    }
    -----------------------------------------------------------------------------------

Both function is work fine to load plain text file, but not work to parse XML file. If I change to prepare messages in text file, I still have problems in parser data. Because one message can be either one sentence or more sentences. That maybe a new problem to split messages to array.

Then I try (XML request) next one, even I don't know what are output should be.

// -------------------------------------------------------------------
// XML request
function NewRequest(service)
{
    xmlFile = service;
    Debug.Trace("Calling: "+xmlFile);
    var xml = new ActiveXObject("MSXML2.DOMDocument.4.0");
    xml.validateOnParse = false;
    xml.async = false;
    xml.load(xmlFile);
    var resp = xml.documentElement;
   
    return resp;
}
// -------------------------------------------------------------------

But I found an error. They say cannot to create obj from
var xml = new ActiveXObject("MSXML2.DOMDocument.4.0");

Because I am very new in XML, I not sure about XML structure.
I don't know how to parse information out.

Please help me! please give me some basic samples will be very kindness.

Thanks
04-30-2009 09:49 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: HELP : Need a solution to load messages to jscript.
The ".4.0" specifies a version of the ActiveXObject to use, although you may not have it. try removing it and seeing if you getany results from just "MSXML2.DOMDocument"
<Eljay> "Problems encountered: shit blew up" :zippy:
04-30-2009 12:04 PM
Profile PM Find Quote Report
Saki
New Member
*


Posts: 6
Joined: Apr 2009
O.P. RE: HELP : Need a solution to load messages to jscript.
Thank you Spunky so much. :D

It's done. Script modified follow your advice work very well.
Now I can continue coding.

Thank Thank Thank:D
04-30-2009 02:50 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