What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Save to XML

Pages: (2): « First « 1 [ 2 ] Last »
Save to XML
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Save to XML
You have 2 ways to open the debugger:
  • In the contact list, open the Plus! menu (note: not the Plus! icon menu, but the one next to the Help menu) and select Script Debugging Window. Select your script in the list and look what the textbox says.
  • In your script, add this to your OnEvent_Initialize function:
    code:
    Debug.DebuggingWindowVisible = true;
    to open the window whenever you start the script. Don't forget to remove it when you're planning to release it!
When you've done that, start your script and see if it gives you an error message.

This post was edited on 10-30-2006 at 04:55 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
10-30-2006 04:54 PM
Profile E-Mail PM Web Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Save to XML
Hi.
The debugger says this:

Scriptet er blevet stoppet
Scriptet startes
Scriptet er startet og er klar
Funktion kaldt: OnGetScriptMenu
Funktion kaldt: OnEvent_MenuClicked
Funktion kaldt: OnWndMainEvent_CtrlClicked
Fejl: 'getElementsByTagName(...).0' er null eller ikke et objekt.
       Linje: 50. Kode: -2146823281.
Funktion OnWndMainEvent_CtrlClicked gav en fejl. Kode: -2147352567
Funktion kaldt: OnWndMainEvent_CtrlClicked


I have tried to translate to english:

The scriptet has been stopped
The script is starting
The script is started and are ready
Function called: OnGetScriptMenu
Function called: OnEvent_MenuClicked
Function called: OnWndMainEvent_CtrlClicked
Error: 'getElementsByTagName(...).0' is null or isn't a object.
       Line: 50. Code: -2146823281.
Function OnWndMainEvent_CtrlClicked gave an error. Code: -2147352567
Function called: OnWndMainEvent_CtrlClicked

This post was edited on 10-30-2006 at 05:02 PM by SnuZZer.
10-30-2006 05:01 PM
Profile E-Mail PM Web Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Save to XML
Hi.
Now it works!
I have written "Navn" instead of "Indstillinger".

code:
function OnWndMainEvent_CtrlClicked(Wnd, Handling)
{
    switch(Handling)
    {
        case "knap_tilfoej":
            var Sti = MsgPlus.ScriptFilesPath + "\\indstillinger.xml";
            var Navn = Wnd.GetControlText("input_navn");
            var Modtaget = Wnd.GetControlText("input_modtaget");
            var Svar = Wnd.GetControlText("input_svar");

            var xml = new ActiveXObject("Microsoft.XMLDOM");
            xml.load(Sti);
            var toAdd = xml.createElement("Navn");
            toAdd.appendChild(xml.createTextNode(Navn));
            xml.getElementsByTagName("Indstillinger")[0].appendChild(toAdd);
            xml.save(Sti);
            Wnd.Close(1);
            break;
        case "knap_luk":
            Wnd.Close(1);
            break;
    }
}

But I still got a problem :-$
How can I add more to the XML-document in one? So - I got more information to add, and how can i give it a ID?
Like this:
code:
<?xml version="1.0" encoding="UTF-8"?>
<Indstillinger>
<Navn Id="Test">
<Modtaget>Hej</Modtaget>
<Svar>Hey!</Modtaget>
</Navn>
<Navn Id="Trala">
<Modtaget>Yeah!</Modtaget>
<Svar>Yeees!!</Modtaget>
</Navn>
</Indstillinger>

This post was edited on 10-30-2006 at 07:05 PM by SnuZZer.
10-30-2006 07:04 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Save to XML
quote:
Originally posted by Plan-1130
Which is the My Documents folder and i found that very unlikely to put an XML file...

Erm, no... The MsgPlus.ScriptFilesPath is the local folder. You can only write a file to "My Documents" using a full path
<Eljay> "Problems encountered: shit blew up" :zippy:
10-30-2006 08:38 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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