Shoutbox

Window does not show up - 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: Window does not show up (/showthread.php?tid=63244)

Window does not show up by Sh4wn on 07-14-2006 at 08:47 AM

I'm making a script, and I want a configuration window. But the problem is, when I click the menu entry of my script, no window shows up. I've added some Debug.Trace() in the same event, and they appear in the debugger console.

My interface.xml file is valid (I Created and validated it with XML Spy).

These are my files:

interface.xml

code:
<?xml version="1.0" encoding="UTF-8"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
    <GlobalColors>
        <GlobalColor Id="green">
            <Red>80</Red>
            <Green>200</Green>
            <Blue>65</Blue>
            <Alpha>220</Alpha>
        </GlobalColor>
        <GlobalColor Id="red">
            <Red>250</Red>
            <Green>0</Green>
            <Blue>0</Blue>
            <Alpha>220</Alpha>
        </GlobalColor>
        <GlobalColor Id="white">
            <Red>255</Red>
            <Green>255</Green>
            <Blue>255</Blue>
            <Alpha>255</Alpha>
        </GlobalColor>
        <GlobalColor Id="black">
            <Red>0</Red>
            <Green>0</Green>
            <Blue>0</Blue>
            <Alpha>255</Alpha>
        </GlobalColor>
        <GlobalColor Id="grey">
            <Red>223</Red>
            <Green>223</Green>
            <Blue>223</Blue>
            <Alpha>255</Alpha>
        </GlobalColor>
        <GlobalColor Id="ref">
            <BaseColor>
                <Saturation>2.5</Saturation>
                <Brightness>0.8</Brightness>
                <Transparency>220</Transparency>
            </BaseColor>
        </GlobalColor>
    </GlobalColors>
    <Window Id="WndFileCfg" Version="1">
        <Attributes>
            <Caption>Configure File Sender</Caption>
        </Attributes>
        <TitleBar>
            <Title>
                <Text>Configure File Sender</Text>
            </Title>
        </TitleBar>
        <Position Width="350" Height="275"/>
        <DialogTmpl>
            <BottomBar Style="Plain">
                <RightControls>
                    <Control xsi:type="ButtonControl" Id="btnClose">
                        <Position Top="0" Width="60" Left="0"/>
                        <Caption>Close</Caption>
                    </Control>
                </RightControls>
            </BottomBar>
        </DialogTmpl>
        <Controls>
            <Control xsi:type="StaticControl" Id="lblTitle">
                <Position Top="10" Width="250" Left="10"/>
                <Color>
                    <GlobalColor>ref</GlobalColor>
                </Color>
                <Font>
                    <Bold>true</Bold>
                    <Size>12</Size>
                </Font>
                <Caption>File Sender Configuration</Caption>
            </Control>
        </Controls>
    </Window>
</Interfaces>


Sendfiles.js
code:
/******************************************************************
*  Script made by Lucas van dijk
*
*  This script sends a specific file on command
*******************************************************************/

// Global vars
var valid_files = new Array();
valid_files[0] = new File("boten anna", "C:\\Documents and Settings\\Lucas\\My Documents\\My Music\\BassHunter - Boten Anna.mp3");
valid_files[1] = new File("file sender", "C:\\Program Files\\Messenger Plus! Live\\Scripts\\Sendfiles\\Sendfiles.plsc");

function OnEvent_Initialize(MessengerStart)
{
    // Nothing here @ the moment   
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function trim(string)
{
    // Remove whitesc
    while(string.charAt(0) == ' ')
    {
        string = string.substring(1);
    }
   
    while(string.charAt(string.length - 1) == ' ')
    {
        string = string.substr(0, string.length - 1);
    }
   
    return string;
}

function OnEvent_ChatWndReceiveMessage(wnd, user, message, kind)
{
    if(message.charAt(0) == "!")
    {
        var command = trim(message.substring(1, message.indexOf(" ")));
        var param = trim(message.substring(message.indexOf(" ")));
       
        Debug.Trace("Command: " + command + ", param: " + param);
       
        switch(command)
        {
            case "send":
                var valid = false;
               
                for(var i = 0; i < valid_files.length; i++)
                {
                    if(param == valid_files[i].getName())
                    {
                        wnd.SendFile(valid_files[i].getPath());
                        valid = true;
                        break;
                    }
                }
               
                if(!valid)
                {
                    var message;
                    message = "Het opgegeven bestand is niet geldig.\nJe kan kiezen uit de volgende bestanden:\n\n";
               
                    for(var i = 0; i < valid_files.length; i++)
                    {
                        message += (i+1) + ". " + valid_files[i].getName() + "\n";
                    }
               
                    wnd.SendMessage(message);
                }
            break;
        }
    }
}                       
               
function OnGetScriptMenu(Location)
{
    return "<ScriptMenu><MenuEntry Id='MenuFileCfg'>Configure File Sender</MenuEntry></ScriptMenu>";
}

function OnEvent_MenuClicked(id, Location, wnd)
{
    if(id == "MenuFileCfg")
    {
        Debug.Trace("Create CFG window..");
        MsgPlus.CreateWnd("interface.xml", "WndFileCfg");
        Debug.Trace("Done.");
    }
}

function OnWndFileCfgEvent_CtrlClicked(wnd, ctrl_id)
{
    switch(ctrl_id)
    {
        case "btnClose":
            wnd.Close();
        break;
    }
}


What's the problem?

Omfg, no identing here ^o)
RE: Window does not show up by Silentdragon on 07-14-2006 at 09:05 AM

Did you save it as a Unicode document? Open and save in wordpad should do it. Although I just skimmed through the code, but try the Unicode first.


RE: Window does not show up by Sh4wn on 07-14-2006 at 09:10 AM

Ah great thanks! Got it working. :D