What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Need to know js saving text in xml

[Help] Need to know js saving text in xml
Author: Message:
jf85
New Member
*


Posts: 4
Joined: Oct 2011
O.P. [Help] Need to know js saving text in xml
Hi and thanks for looking in !


I'm total new on JavaScript so i ask for a little help.
My questions is what line of code do i have to wright
so that the following adds extra lines when received message in msn like this under:

Client message: !learn "hello" "hi"
makes it save in xml file :


(Orginal when not been told)
quote:
<?xml version="1.0" encoding="UTF-8"?>
<Answers>
    <Misc>
        <DelayEnabled>1</DelayEnabled>
        <DelayTime>0</DelayTime>
    </Misc>
    <Entry name="1">
        <Receive>^!learn</Receive>
        <Answer>!learn "Question" "Anwser"</Answer>
        <Type>Fragment</Type>
        <Flags>10</Flags>
        <MatchCount>1</MatchCount>
        <Status>255</Status>
        <Enabled>1</Enabled>
        <Delay>0</Delay>
    </Entry>
</Answers>

(When told)
quote:
<?xml version="1.0" encoding="UTF-8"?>
<Answers>
    <Misc>
        <DelayEnabled>1</DelayEnabled>
        <DelayTime>0</DelayTime>
    </Misc>
    <Entry name="1">
        <Receive>^!learn</Receive>
        <Answer>!learn "Question" "Anwser"</Answer>
        <Type>Fragment</Type>
        <Flags>10</Flags>
        <MatchCount>1</MatchCount>
        <Status>255</Status>
        <Enabled>1</Enabled>
        <Delay>0</Delay>
    </Entry>
    <Entry name="2">
        <Receive>hello</Receive>
        <Answer>hi</Answer>
        <Type>Fragment</Type>
        <Flags>10</Flags>
        <MatchCount>1</MatchCount>
        <Status>255</Status>
        <Enabled>1</Enabled>
        <Delay>0</Delay>
    </Entry>
</Answers>

In summon up in simple words. script that saves new entry number like the 2 and the
!learn "hello" "hi" saves  "hello" and "hi" like entry 2
so if new "receive" is received then it saves new entry like 2 then 3 and 4 and so on.


Would be sooo glad to have helping hand on this
so ides is great full welcome to !


If you got questions just ask !
sincerely John F :$

10-13-2011 10:18 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] Need to know js saving text in xml
Have a look at this: http://stackoverflow.com/questions/1192286/create...e-using-javascript
10-13-2011 02:39 PM
Profile E-Mail PM Find Quote Report
jf85
New Member
*


Posts: 4
Joined: Oct 2011
O.P. RE: RE: [Help] Need to know js saving text in xml
quote:
Originally posted by matty
Have a look at this: http://stackoverflow.com/questions/1192286/create...e-using-javascript

Hmm thanks for the tip but it got no use for me.
Reason :
it only tells how to make predefine absolute message
so if i were to use it
then it would only wright the word that it alreddy got and not been told
so in other words the only thing i can use from it is the function that it saves
(without msn fuction)



Maby this code tells u more if it helps you to help me xD

function xmlSaveSettings(sName,sReceive,sAnswer,sType,iFlags,sMatchCount,iStatus,bEnabled,iDelay) {
    var xml = createDOM();
    var xml2 = createDOM();
    var xmlIndent = createDOM();
    xmlIndent.loadXML(xsl);
    if(checkXMLExists())
        xml.load(logFile);
    else {
        var PreProc = xml.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
        xml.appendChild(PreProc);
        PreProc = xml.createElement("Answers");
        xml.appendChild(PreProc);
        PreProc - xml.createElement("Misc");
        xml.appendChild(PreProc);
    }
   
    var node = xml.selectSingleNode("Answers");
    var newAnswerEntry = xml.createElement("Entry");
    newAnswerEntry.setAttribute("name", encodeURI(sName));

    var newReceive = xml.createElement("Receive");
    newReceive.text = sReceive;
    newAnswerEntry.appendChild(newReceive);

    var newAnswer = xml.createElement("Answer");
    newAnswer.text = sAnswer;
    newAnswerEntry.appendChild(newAnswer);

    var newType = xml.createElement("Type");
    newType.text = sType;
    newAnswerEntry.appendChild(newType);

    var newFlags = xml.createElement("Flags");
    newFlags.text = iFlags;
    newAnswerEntry.appendChild(newFlags);

    var newMatchCount = xml.createElement("MatchCount");
    newMatchCount.text = sMatchCount;
    newAnswerEntry.appendChild(newMatchCount);
   
    var newStatus = xml.createElement("Status");
    newStatus.text = iStatus;
    newAnswerEntry.appendChild(newStatus);
   
    var newEnabled = xml.createElement("Enabled");
    newEnabled.text = bEnabled;
    newAnswerEntry.appendChild(newEnabled);
   
    var newDelay = xml.createElement("Delay");
    newDelay.text = iDelay;
    newAnswerEntry.appendChild(newDelay);

    node.appendChild(newAnswerEntry);

    xml.transformNodeToObject(xmlIndent, xml2);
    xml2.save(logFile);
}


(code created by the maker of Answer Machine Plus)

This post was edited on 10-13-2011 at 10:20 PM by Spunky.
10-13-2011 03:16 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