Shoutbox

[request]part of script - 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: [request]part of script (/showthread.php?tid=69299)

[request]part of script by Kutar on 12-09-2006 at 04:35 PM

I want to make a script that may create a plus Wnd.
The XML file I have made.
But I don't know how to use a js file to "call" the xml file(Create a PlusWnd)

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if(Message == 'r') {
    MsgPlus.DisplayToast('Uno顏色解讀', '紅色');
    }
else if(Message == 'R') {
    MsgPlus.DisplayToast('Uno顏色解讀', '紅色');
    }
else if(Message == 'y') {
    MsgPlus.DisplayToast('Uno顏色解讀', '黃色');
    }
else if(Message == 'Y') {
    MsgPlus.DisplayToast('Uno顏色解讀', '黃色');
    }
else if(Message == 'g') {
    MsgPlus.DisplayToast('Uno顏色解讀', '綠色');
    }
else if(Message == 'G') {
    MsgPlus.DisplayToast('Uno顏色解讀', '綠色');
    }
else if(Message == 'b') {
    MsgPlus.DisplayToast('Uno顏色解讀', '藍色');
    }
else if(Message == 'B') {
    MsgPlus.DisplayToast('Uno顏色解讀', '藍色');
    }
if(Message == 'bk') {
    MsgPlus.DisplayToast('Uno牌類解讀', '禁止');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno牌類解讀', '禁止');
    }
else if(Message == 'bK') {
    MsgPlus.DisplayToast('Uno牌類解讀', '禁止');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno牌類解讀', '禁止');
    }
switch (Message){
    case "wt cl?":
    MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");
    break;
    }

}
(above was a part of my script, it includes some Chinese)
the bold words was the problem.
Anybody help me?


RE: [request]part of script by Felu on 12-09-2006 at 06:23 PM

Try

code:
PlusWnd =     MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");


Also make sure that the XML is Unicode.
RE: [request]part of script by foaly on 12-09-2006 at 06:55 PM

quote:
Originally posted by -!Felu!-
PlusWnd = MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");
shouldn't that be:
code:
var PlusWnd = MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");


and the XML has to  be in unicode 16...
RE: [request]part of script by Matti on 12-09-2006 at 07:29 PM

quote:
Originally posted by foaly
shouldn't that be:
code:
var PlusWnd = MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");


It depends: if you want to make PlusWnd a local variable (removed when OnEvent_ChatWndSendMessage ends), you add "var" in front of it. If you want it to be a global variable, you drop the "var"
quote:
Originally posted by foaly
and the XML has to  be in unicode 16...
That is UTF-16:
quote:
Originally posted by Wikipedia
In computing, UTF-16 (16-bit Unicode Transformation Format) is a variable-length character encoding for Unicode, capable of encoding the entire Unicode repertoire.
:P
RE: [request]part of script by Kutar on 12-10-2006 at 01:57 AM

Let us check the whole but incomplete files now.....
XML

quote:
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="">
    <Window Id="WndColor" Version="1">
        <Attributes>
            <Caption>&#38991;&#33394;&#27770;&#23450;</Caption>
        </Attributes>
        <TitleBar>
            <Title>
                <Text>&#38991;&#33394;&#27770;&#23450;</Text>
            </Title>
        </TitleBar>
        <Position Width="200" Height="355"/>
        <DialogTmpl/>
        <Controls>
            <Control xsi:type="StaticControl" Id="LblText" Visible="true" Enabled="true">
                <Position Top="10" Left="10" Width="100" Height="15"/>
                <Color>
                    <GlobalColor>heading</GlobalColor>
                </Color>
                <Font>
                    <Bold>true</Bold>
                    <Size>11</Size>
                </Font>
                <Caption>&#38991;&#33394;&#27770;&#23450;</Caption>
            </Control>
            <Control xsi:type="ButtonControl" Id="Red">
                <Position Top="305" Left="10" Width="50"/>
                <Caption>&#32005;&#33394;</Caption>
            </Control>
            <Control xsi:type="ButtonControl" Id="Blue">
                <Position Top="305" Left="70" Width="50"/>
                <Caption>&#34253;&#33394;</Caption>
            </Control>
            <Control xsi:type="ButtonControl" Id="Green">
                <Position Top="305" Left="130" Width="50"/>
                <Caption>&#32160;&#33394;</Caption>
            </Control>
            <Control xsi:type="ButtonControl" Id="Yellow">
                <Position Top="305" Left="190" Width="50"/>
                <Caption>&#40643;&#33394;</Caption>
            </Control>
        </Controls>
    </Window>
</Interfaces>


Js File

quote:
//&#20491;&#20154;&#23560;&#29992; : &#35299;&#35712;MSN&#36938;&#25138;Uno&#30340;&#23494;&#30908;, &#21487;&#29992;&#26044;&#20491;&#20154;&#29992;&#36884;

var WndColor;
var uno = '0';

function OnEvent_Initialize(MessengerStart)
{
}

function OnWndColorEvent_CtrlClicked(PlusWnd,ControlId) {
    if(ControlId == "Red") {
        ChatWnd.SendMessage('&#32005;&#33394;');
        WndColor.Close(0);
    }
    else if(ControlId == "Blue") {
        ChatWnd.SendMessage('&#34253;&#33394;');
        WndColor.Close(0);
    }
    else if(ControlId == "Yellow") {
        ChatWnd.SendMessage('&#40643;&#33394;');
        WndColor.Close(0);
    }
    else if(ControlId == "Green") {
        ChatWnd.SendMessage('&#32160;&#33394;');
        WndColor.Close(0);
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if(Message == 'r') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
    }
else if(Message == 'R') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
    }
else if(Message == 'y') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
    }
else if(Message == 'Y') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
    }
else if(Message == 'g') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
    }
else if(Message == 'G') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
    }
else if(Message == 'b') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
    }
else if(Message == 'B') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
    }
if(Message == 'bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'bK') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
switch (Message){
    case "wt cl?":
    PlusWnd = MsgPlus.CreateWnd("ChoicesWnd.xml","WndColor");
    break;
    }
}


Thanks for all your relpies(Sorry for my poor English, I am Macanese).
RE: [request]part of script by Felu on 12-10-2006 at 04:28 AM

Changed the window a bit. Also saved it as UTF-16 :)

PS : The file's extension is txt as xml files are not allowed to be uploaded.


RE: [request]part of script by Kutar on 12-10-2006 at 05:18 AM

thx~:D
The pluswnd showed.
But another question:

quote:
function OnWndColorEvent_CtrlClicked(PlusWnd,ControlId) {
if(ControlId == "Red") {
ChatWnd.SendMessage('&#32005;&#33394;');
WndColor.Close(0);
}
else if(ControlId == "Blue") {
ChatWnd.SendMessage('&#34253;&#33394;');
WndColor.Close(0);
}
else if(ControlId == "Yellow") {
ChatWnd.SendMessage('&#40643;&#33394;');
WndColor.Close(0);
}
else if(ControlId == "Green") {
ChatWnd.SendMessage('&#32160;&#33394;');
WndColor.Close(0);
}
}


When I click the button, there's nothing happened.
I wanted the result wil be like this:
Click the first button, send something to my contact, click the second button, send another thing....
Please help me to check that part of the js file above, or see the post before last post and check the whole js file for me.) Give 100000000 thanks!
RE: [request]part of script by Felu on 12-10-2006 at 05:36 AM

Is ChatWnd global variable?
Also use PlusWnd.Close(0);


RE: [request]part of script by Kutar on 12-10-2006 at 05:49 AM

:S
The plusWnd is here but nothing happens too~

quote:
//&#20491;&#20154;&#23560;&#29992; : &#35299;&#35712;MSN&#36938;&#25138;Uno&#30340;&#23494;&#30908;, &#21487;&#29992;&#26044;&#20491;&#20154;&#29992;&#36884;

var WndColor;
var uno = '0';

function OnEvent_Initialize(MessengerStart)
{
}

function OnPlusWndEvent_CtrlClicked(PlusWnd,ControlId) {
    if(ControlId == "Red") {
        ChatWnd.SendMessage('&#32005;&#33394;');
        PlusWnd.Close(0);
    }
    else if(ControlId == "Blue") {
        ChatWnd.SendMessage('&#34253;&#33394;');
        PlusWnd.Close(0);
    }
    else if(ControlId == "Yellow") {
        ChatWnd.SendMessage('&#40643;&#33394;');
        PlusWnd.Close(0);
    }
    else if(ControlId == "Green") {
        ChatWnd.SendMessage('&#32160;&#33394;');
        PlusWnd.Close(0);
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if(Message == 'r') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
    }
else if(Message == 'R') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
    }
else if(Message == 'y') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
    }
else if(Message == 'Y') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
    }
else if(Message == 'g') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
    }
else if(Message == 'G') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
    }
else if(Message == 'b') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
    }
else if(Message == 'B') {
    MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
    }
if(Message == 'bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'bK') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
else if(Message == 'Bk') {
    MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
    }
switch (Message){
    case "wt cl?":
    PlusWnd = MsgPlus.CreateWnd("Window.xml","WndColor");
    break;
    }
}


I want the result wil be like this:
Click the first button, send 'red'(without quotes) to my contact, click the second button, send 'blue' and so on.
To do this, I think ChatWnd.SendMessage can help me, but it doesn't work and the pluswnd didn't disappeared after clicking those buttons.

Please help me to check the whole js file. Give 100000000 thanks!
RE: [request]part of script by Felu on 12-10-2006 at 05:58 AM

code:
//&#20491;&#20154;&#23560;&#29992; : &#35299;&#35712;MSN&#36938;&#25138;Uno&#30340;&#23494;&#30908;, &#21487;&#29992;&#26044;&#20491;&#20154;&#29992;&#36884;

var WndColor;
var uno = '0';

function OnEvent_Initialize(MessengerStart)
{
}

function OnWndColorEvent_CtrlClicked(PlusWnd,ControlId) {
if(ControlId == "Red") {
MyChatWnd.SendMessage('&#32005;&#33394;');
PlusWnd.Close(0);
}
else if(ControlId == "Blue") {
MyChatWnd.SendMessage('&#34253;&#33394;');
PlusWnd.Close(0);
}
else if(ControlId == "Yellow") {
MyChatWnd.SendMessage('&#40643;&#33394;');
PlusWnd.Close(0);
}
else if(ControlId == "Green") {
MyChatWnd.SendMessage('&#32160;&#33394;');
PlusWnd.Close(0);
}
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if(Message == 'r') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
}
else if(Message == 'R') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32005;&#33394;');
}
else if(Message == 'y') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
}
else if(Message == 'Y') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#40643;&#33394;');
}
else if(Message == 'g') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
}
else if(Message == 'G') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#32160;&#33394;');
}
else if(Message == 'b') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
}
else if(Message == 'B') {
MsgPlus.DisplayToast('Uno&#38991;&#33394;&#35299;&#35712;', '&#34253;&#33394;');
}
if(Message == 'bk') {
MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
}
else if(Message == 'Bk') {
MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
}
else if(Message == 'bK') {
MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
}
else if(Message == 'Bk') {
MsgPlus.DisplayToast('Uno&#29260;&#39006;&#35299;&#35712;', '&#31105;&#27490;');
}
switch (Message){
case "wt cl?":
MyChatWnd = ChatWnd;
PlusWnd = MsgPlus.CreateWnd("Window.xml","WndColor");
break;
}
}

RE: [request]part of script by Kutar on 12-10-2006 at 06:13 AM

100000000*thanks! It works now~