Shoutbox

A simple question about scripts^^ - 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: A simple question about scripts^^ (/showthread.php?tid=73887)

A simple question about scripts^^ by Light86 on 04-24-2007 at 08:56 PM

Hi 1'm new in script developement and 1 made a script which can make appear a message in a toast when the user logs in...pretty simple 1 know:)
But 1 though...is it possible to make an image appear in the toast too?Or,even better,make it appear for a couple of sec in the middle of the screen?
1 want to make a present for a nice girl..so help me please^^
Thx anyways!


RE: A simple question about scripts^^ by matty on 04-24-2007 at 10:08 PM

You could technically move the toast but you would need to find it using the Windows API

As far as showing an image not possible.


RE: A simple question about scripts^^ by deAd on 04-24-2007 at 10:13 PM

Instead you'll probably want to create a custom window..


RE: A simple question about scripts^^ by Light86 on 04-25-2007 at 10:44 AM

Mmm...and how could 1 make it?


RE: A simple question about scripts^^ by Supersonicdarky on 04-25-2007 at 11:16 AM

code:
function OnEvent_Signin(Email) {
WindowName = MsgPlus.CreateWnd("FileName.xml", "WindowName");
}

then all you have to do is create a window
RE: A simple question about scripts^^ by Light86 on 04-25-2007 at 11:58 AM

Thx much but...how to create the window?xD
Is there a tutorial?


RE: A simple question about scripts^^ by Volv on 04-25-2007 at 12:31 PM

quote:
Originally posted by Light86
Thx much but...how to create the window?xD
Is there a tutorial?
Scripting Documentation - Windows for your Script
RE: A simple question about scripts^^ by Light86 on 04-25-2007 at 02:13 PM

It doesn't work:(
1 created a script called "text window",1 put the file "interface.xml" in this script's folder but still no window appears...wht 1 do wrong?
Could someone post me the istructions?


RE: A simple question about scripts^^ by Spunky on 04-26-2007 at 02:26 PM

Did you make another xml file with the code for the window? If not you need to look at the documentation for an example. If you have, make sure the file is saved as UNICODE-16...


RE: A simple question about scripts^^ by Light86 on 04-26-2007 at 03:06 PM

This is the interface's code(1 tried to save it as Unicode and Big Endian Unicode but nothing),1 save it as .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 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>

And this is the script:

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnEvent_Signin(Email) {
WindowName = MsgPlus.CreateWnd("InterfaceTest.xml", "WindowName");
}

Both are in the folder "WindowTest",the script is on,and when 1 access to msn,a window should be displayed..but nothing :@

Did 1 make some errors in the code?Please helpT_T
RE: A simple question about scripts^^ by foaly on 04-26-2007 at 03:17 PM

quote:
Originally posted by Light86
<Window Id="WndTest" Version="1">
quote:
Originally posted by Light86
"WindowName");
those should be the same...
So use:
var WindowName = MsgPlus.CreateWnd("InterfaceTest.xml", "WndTest");
RE: A simple question about scripts^^ by Light86 on 04-26-2007 at 04:49 PM

Done...the code now is

code:
function OnEvent_Initialize(MessengerStart)
{
    var Wnd = MsgPlus.CreateWnd("InterfaceTest.xml", "WndTest");
}


function OnEvent_Uninitialize(MessengerExit)
{
}



But still 1 can't c any windows when 1 enter msn...1 got plus version 4.20.0.672..maybe it's this the problem?
RE: A simple question about scripts^^ by vikke on 04-26-2007 at 05:00 PM

This could be for following reasons (some mentioned before).
1. The file is not UTF-16 (UNICODE).
2. The XML is not valid (something is wrong with it).
3. The XML-file is not InterfaceTest.xml.


RE: A simple question about scripts^^ by Light86 on 04-26-2007 at 05:23 PM

Thanks much!Now it works:D
But now..how can 1 display a picture inside this window?


RE: A simple question about scripts^^ by vikke on 04-26-2007 at 05:35 PM

You create a folder in your script folder called "Images". Then you put something like this in your <elements>:

code:
        <Element xsi:type="ImageElement" Id="MyImage">
            <Position Top="1" Left="1"/>
            <Image><Name>Image Name here</Name></Image>
        </Element>

It's all in the scripting documentation.
RE: A simple question about scripts^^ by Light86 on 04-26-2007 at 05:51 PM

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 Width="180" Height="75"/>
            <DialogTmpl/>

            <Controls>
                <Control xsi:type="StaticControl" Id="LblTop">
                    <Position Left="10" Top="10" Width="150"/>
                    <Caption>Hello world!</Caption>
                </Control>
             
              <Element xsi:type="ImageElement" Id="MyImage">
              <Position Top="1" Left="1"/>
               <Image><Name>Dark.jpg</Name></Image>
                </Element>


                <Control xsi:type="ButtonControl" Id="BtnClose">
                    <Position Left="112" Top="25" Width="50"/>
                    <Caption>Close</Caption>
                </Control>
            </Controls>
        </Window>

    </Interfaces>

Something still doesn't work...1 don't know very well the xml8-)
Anyway 1 didn't c anything like "how to put an image in a window" in the script documentation...
RE: RE: A simple question about scripts^^ by vikke on 04-26-2007 at 06:17 PM

quote:
Originally posted by Light86
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 Width="180" Height="75"/>
            <DialogTmpl/>

            <Controls>
                <Control xsi:type="StaticControl" Id="LblTop">
                    <Position Left="10" Top="10" Width="150"/>
                    <Caption>Hello world!</Caption>
                </Control>
             
              <Element xsi:type="ImageElement" Id="MyImage">
              <Position Top="1" Left="1"/>
               <Image><Name>Dark.jpg</Name></Image>
                </Element>


                <Control xsi:type="ButtonControl" Id="BtnClose">
                    <Position Left="112" Top="25" Width="50"/>
                    <Caption>Close</Caption>
                </Control>
            </Controls>
        </Window>

    </Interfaces>

Something still doesn't work...1 don't know very well the xml8-)
Anyway 1 didn't c anything like "how to put an image in a window" in the script documentation...

In the <elements> tag, not the controls tag.. The XML should be like this:
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 Width="180" Height="75"/>
            <DialogTmpl/>

            <Elements>
                     <Element xsi:type="ImageElement" Id="MyImage">
                                <Position Top="1" Left="1"/>
                                <Image><Name>Dark.jpg</Name></Image>
                     </Element>
             </Elements>
            <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>
I suggest you to learn XML, it will help you a lot. If this still doesn't work, try converting Dark.jpg to Dark.png, and just enter:
code:
<Image><Name>Dark</Name></Image>

RE: A simple question about scripts^^ by Light86 on 04-26-2007 at 06:33 PM

It worked u're great!:D
But really xml is so useful?
Anyway there's another prob(please have a little more patienceT_T):the image is too big for this window...is there a way to increase its size?
[Solved!Thx everyone for the help!!!1 hope to post a script of mine too in this forum  someday;)]


RE: A simple question about scripts^^ by Volv on 04-27-2007 at 07:16 AM

quote:
Originally posted by Light86
But really xml is so useful?
Yes, it is being used more and more often with application-internet interaction and often in layout design as it provides clear, understandable, and easily parsed data. Not to mention you need to know at least a bit to create a Plus script without being spoon fed everything.

quote:
Originally posted by Light86
the image is too big for this window...is there a way to increase its size?
You already specified the window's width and height so just change the values...

Also, I suggest you read all the help topics under 'XML Schemas Reference' > 'Interface Windows' in the script documentation at http://m00.cx/mpl/docs/index.html?page=ref-interface-schema.htm (or you can download it from the Scripts Database http://www.msgpluslive.net/scripts/view/13-Official-Scripting-Documentation/
The scripting documentation is there for a reason and it is extremely useful and helpful - all script developers have to refer to it to make Plus Scripts as it is the only documentation which exists for it. Also referring to other scripts which do something similar or have features you would like to incorporate would be useful.

quote:
Originally posted by Light86
1 hope to post
'1' doesnt mean 'I' so stop using it, it's really getting on my nerves as it makes your more difficult to understand.