Shoutbox

creat window - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: creat window (/showthread.php?tid=82797)

creat window by desithugg on 03-30-2008 at 01:03 AM

Hi well i'm just starting out with scripting and i'm having some trouble creating a window. I followed the Scripting documentation but it doesn't seem to be working.

Here's the xml window code (name: saad.xml)

code:
<Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    <Window Id="WndTest" Version="1">        <Attributes>            <Caption>Test Window</Caption>
        </Attributes>
        <TitleBar>
            <Title><Text>Hello!</Text></Title>
        </TitleBar>
        <Position ClientWidth="170" ClientHeight="45"/>
        <DialogTmpl/>
        <Controls>
            <Control xsi:type="StaticControl" Id="LblTop">
                <Position Left="10" Top="10" Width="150"/>
                <Caption>Hello world!</Caption>
            </Control>
            <Control xsi:type="ButtonControl" Id="BtnClose">
                <Position Left="115" Top="25" Width="50"/>                <Caption>Close</Caption>
            </Control>
        </Controls>
    </Window>
</Interfaces>

and here's the script
code:
function OnEvent_Initialize(MessengerStart){
    var Wnd = MsgPlus.CreateWnd("saad.xml", "form1");
    MsgPlus.DisplayToast("testing","testing...");
}

I placed the xml file in the script directory, but it doesn't work. By the way the toast does show.
RE: creat window by NanaFreak on 03-30-2008 at 01:10 AM

var Wnd = MsgPlus.CreateWnd("saad.xml", "WndTest");


RE: creat window by MeEtc on 03-30-2008 at 01:10 AM

In the JS code you wrote, you're not opening the window that you wrote above in the XML.

code:
var Wnd = MsgPlus.CreateWnd("saad.xml", "form1");
That needs to be changed to "WndTest", the same as the Id name you gave it in the XML.
RE: creat window by desithugg on 03-30-2008 at 01:13 AM

ohh got it, thanks!

no luck :S i made sure the names match now and still won't work


RE: creat window by CookieRevised on 03-30-2008 at 02:07 AM

Make sure you have saved the XML as a unicode file and that it is placed in the script's directory.

;)

-----------

@Patchou
This is maybe something to be added to the scripting docs: files must be saved as unicode. At first glance I don't see a mention of that anywhere, certainly not in the basic sections like "getting started" or "examples" section or something.


RE: creat window by desithugg on 03-30-2008 at 02:17 AM

Hey thanks, that was the problem. I had it saved as ANSI, thanks a lot. Was going crazy over that. I can finally do something now.


RE: creat window by hitokiri_3 on 04-13-2008 at 10:37 PM

hello,
I have the same problem but i don't know if my xml file is an ANSI or an Unicode.
My editor is Context.
Could you help me?


RE: RE: creat window by desithugg on 04-13-2008 at 10:43 PM

quote:
Originally posted by hitokiri_3
hello,
I have the same problem but i don't know if my xml file is an ANSI or an Unicode.
My editor is Context.
Could you help me?

Hey umm try this open notepad, copy your xml code in there and click File > Save As
enter the file name and than where it says encoding select unicode
RE: creat window by Matti on 04-14-2008 at 04:27 PM

I've quickly installed ConTEXT (looks like a pretty neat editor :P), and after a quick search, I found the option to set the save format:

  1. In the menu bar, choose Options > Environment Options...
  2. Open the tab "Editor"
  3. In the "File format" drop-down, choose "Unicode".
    [Image: attachment.php?pid=902655]
  4. Click OK. :)
Now, when you save a file, it'll be saved as Unicode. Pay attention to this when you're using it for other projects too (C++, PHP,...) as those languages may not like Unicode, then you'll have to switch that option back to DOS for those cases.
RE: creat window by hitokiri_3 on 04-14-2008 at 07:20 PM

thank,it's easy and ok with the notepad .