Shoutbox

Create Wnd - 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: Create Wnd (/showthread.php?tid=78872)

Create Wnd by Cryon on 11-08-2007 at 05:10 PM

i can't use CreateWnd in my script. here is the code:

function OnEvent_Initialize(MessengerStart)
{
    Debug.Trace("Hello World!");
}

function OnEvent_Signin(Email)
{
    if(Email == "jonathan.sweden@hotmail.com") //Change for your sign-in email
    {
    var Message = "Hi Master " + Messenger.MyName + "!";
    Message = MsgPlus.RemoveFormatCodes(Message);
    MsgPlus.DisplayToast("My First Script", Message);
    }
}

function OnEvent_Signout(Email)
{
    if(Email == "jonathan.sweden@hotmail.com") //Change for your sign-in email
    {
    var Message = "Bye Master " + Messenger.MyName + ".";
    Message = MsgPlus.RemoveFormatCodes(Message);
    MsgPlus.DisplayToast("My First Script", Message);
    }
}

function OnGetScriptMenu(Location)
{
    var ScriptMenu = "<ScriptMenu>";
    ScriptMenu += "<MenuEntry Id=\"Options\">Options...</MenuEntry>";
    ScriptMenu += "<Separator/>";
    ScriptMenu += "<MenuEntry Id=\"About\">About...</MenuEntry>";
    ScriptMenu += "</ScriptMenu>"; return ScriptMenu;
}

function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd) {
   switch(MenuItemId) {
      case 'Options':
         toast1();
         break;
      case 'About':
         toast2();
         break;
   }
}


function toast1() {
     Wnd = MsgPlus.CreateWnd("Options.xml", "WndOptions");
}

function toast2() {
    MsgPlus.DisplayToast('My First Script', 'Created by: Cryon\n\Website: http://web.telia.com/~u50701082\n\E-mail: Jonathan.sweden@hotmail.com');
}

function OnEvent_Uninitialize(MessengerExit)
{
    Debug.Trace("Bye World.");
}


it's in "function Toast1()" please help!:(
i'm sorry... i cant much English, i'm from sweden...:S


RE: Create Wnd by Felu on 11-08-2007 at 05:28 PM

The function toast1, seems to be perfectly fine to me. Do you get any errors in the debug window(I don't think there should be any, but still...).

What is the XML code you are using for the windows? Could you please upload the Options.xml file as an attachment?


RE: Create Wnd by Cryon on 11-08-2007 at 05:33 PM

here:
<Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Window Id="WndOptions" Version="1">
        <Attributes>
            <Caption>Test Window</Caption>
        </Attributes>
        <TitleBar>
            <Title><Text>Hello!</Text></Title>
        </TitleBar>
        <Position Width="180" Height="75"/>
        <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="112" Top="25" Width="50"/>
                <Caption>Close</Caption>
            </Control>
        </Controls>
    </Window>
</Interfaces>

something wrong?


RE: Create Wnd by Spunky on 11-08-2007 at 06:49 PM

You might need to save the XML file in Unicode...


RE: Create Wnd by Cryon on 11-08-2007 at 07:26 PM

thanks
now I'm very happy!


RE: Create Wnd by fmonroy on 12-19-2007 at 12:46 AM

Please set the unicode thing with bolds at the doc.