Shoutbox

Very simple script - very simple problem (I hope) - 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: Very simple script - very simple problem (I hope) (/showthread.php?tid=89387)

Very simple script - very simple problem (I hope) by Oceanor on 02-25-2009 at 01:41 PM

Hi, first of all, sorry for my bad english, I'm italian and i'm trying to translate better as possible. Here's my problem: I have to make a very simple script: some phrases personalizables in some points, such as:

Hi there! Today i'm *PERSONALIZED TEXT*

I want to make an XML window with a text box to write personalized text, but I cannot find the function to get the text and send the phrase  with personalization in the chatwindow.

If possibile, i want to make another text box to specify the chatwindow where the text will be written (I.E. e-mail of the receiver)



Surely this is an useless script, but is the base to improve other scripts :(


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-26-2009 at 11:04 AM

up: i've reviewed some scripts to understand how xml works, but i have just a problem: why in the JS file some controls are named BtnCancel, BtnClose, BtnAbout and in the XML file the corrispondent control have IDs named BtnCancel, BtnClose, BtnDisable? How can i create a new control if names are different? :@


RE: Very simple script - very simple problem (I hope) by djdannyp on 02-26-2009 at 11:25 AM

You can call the control whatever you want

You could call it BtnDestroyTheWorld and as long as when attributing the function you used that name, then it will do whatever you tell it


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-26-2009 at 12:08 PM

Thanks for the answer ;)

My problem if different: I'm watching a script (message gradiator) and in the XML file there are 3 buttons:

<Control xsi:type="ButtonControl" Id="BtnDisable"><Position Top="220" Left="45" Width="60"/><Caption>Disabilita</Caption></Control>

<Control xsi:type="ButtonControl" Id="BtnClose"><Position Top="220" Left="115" Width="60"/><Caption>Salva e Esci</Caption></Control>

<Control xsi:type="ButtonControl" Id="BtnCancel"><Position Top="220" Left="185" Width="60"/><Caption>Annulla</Caption></Control>

Ids are "BtnDisable",BtnClose",BtnCancel", and they are 3 buttons to save, cancel and exit from the xml window.

If i want to rename these IDs or create another button to quit from the window, where I have to change something? If I change IDs, buttons become useless.. so, in other words, where the ids are linked?

Ps. no traces of these IDs with a search in the JS part.


RE: RE: Very simple script - very simple problem (I hope) by djdannyp on 02-26-2009 at 12:17 PM

quote:
Originally posted by Oceanor
Ps. no traces of these IDs with a search in the JS part.


js code:


Look more carefully ;)
RE: Very simple script - very simple problem (I hope) by Oceanor on 02-26-2009 at 01:20 PM

oh god thank you! I'll try to make a script from 0 in some hour.. :D:D


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-26-2009 at 05:40 PM

code:
<Controls>
    <Control xsi:type="StaticControl" Id="Title">
        <Position Top="8" Width="350" Left="110" Height="40"/>
        <Font><Size>12</Size></Font>
        <Caption>Mio Profilo</Caption>
    </Control>
   
    <!-- Frase n1 -->
    <Control xsi:type="StaticControl" Id="Nome">
        <Position Top="25" Width="100" Left="5" Height="10"/>
        <Caption>Nome: </Caption>
        <Font><Bold>true</Bold></Font>
    </Control>

    <Control xsi:type="EditControl" Id="NuovoNome">
        <Position Top="25" Width="170" Left="70"/>
        <Caption></Caption>
        <Font><Bold>True</Bold></Font>
    </Control>

    <Control xsi:type="ButtonControl" Id="BtnConfermaNome">
        <Position Top="25" Left="250" Width="40"/>
        <Caption>Conferma</Caption>
    </Control>
   
    <!-- Frase n2 -->
    <Control xsi:type="StaticControl" Id="Frase">
        <Position Top="40" Width="100" Left="5" Height="10"/>
        <Caption>Cognome: </Caption>
        <Font><Bold>true</Bold></Font>
    </Control>

    <Control xsi:type="EditControl" Id="NuovaFrase">
        <Position Top="40" Width="170" Left="70"/>
        <Caption></Caption>
        <Font><Bold>True</Bold></Font>
    </Control>

    <Control xsi:type="ButtonControl" Id="BtnConfermaFrase">
        <Position Top="40" Left="250" Width="40"/>
        <Caption>Conferma</Caption>
    </Control>

   
   
   
   
    <Control xsi:type="ButtonControl" Id="BtnAbout">
        <Position Top="220" Left="45" Width="60"/>
        <Caption>Informazioni</Caption>
    </Control>

    <Control xsi:type="ButtonControl" Id="BtnCancel">
        <Position Top="220" Left="185" Width="60"/>
        <Caption>Chiudi finestra</Caption>
    </Control>

</Controls>


This is my XML part (just 2 lines + 2 buttons, close window and information. Here's the JS part:

code:
function OnOptionsEvent_CtrlClicked(Wnd, ControlId)
{
    if(ControlId == "BtnAbout")
    {
        var Wnd = MsgPlus.CreateWnd("gui.xml", "About");
    }
   
    if(ControlId == "BtnConfermaNome")
    {
        Wnd.Close(1);
    }
   
    if(ControlId == "BtnCancel")
    {
        Wnd.Close(1);
    }
}


When I click the BtnCancel button, the window is closed, but when i click BtnConfermaNome, nothing happens.

Obviusly, for now most buttons are useless, but i'm interested in understanding why nothing happen with some names and works with BtnCancel..

:(:(:(:(:(:(:(:(
RE: Very simple script - very simple problem (I hope) by matty on 02-26-2009 at 06:36 PM

BtnCancel is automatically supported by Plus! to close the window without the need of any code. Therefore your function may not actually be called. Turn on Event traceing in the debug window first off.

Secondly post all of the code from the XML and the JS file so we can take a look at all of it. Just giving us what you did doesn't show any issues. (Reason I am asking is your Window may not actually be called Options. function OnWindowIdEvent_CtrlClicked() therefore you replace WindowId with the name of yoru window.)


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-27-2009 at 12:02 AM

Many many thanks.. finally i found the solution to my problem :)

I forgot to rename
function OnOptionsEvent_CtrlClicked(Wnd, ControlId)
in
function OnFinestracomandiEvent_CtrlClicked(Wnd, ControlId)

because I didn't know this modify to the function before..

So, thanks djdannyp and matty, if i can do something for you, just afk me :)


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-27-2009 at 10:04 AM

Err, sorry again, another question ^^'

How can i edit a XML window having a preview of it? For now every change that i make i have to rar the xml file into the archive, rename it to plsc, import the script, start the script from messenger and view the window.. :(


RE: Very simple script - very simple problem (I hope) by Matti on 02-27-2009 at 10:09 AM

You don't have to re-import your script at all to see the changes! :O
All script files are stored in Program Files\Messenger Plus! Live\Scripts so if you change a file there, Plus! will load the changes. This goes for any file in your script, so instead of working from some folder outside Plus!, work on your project in Plus!' own folder!
Oh, and enable the script debugger if you haven't already, so Plus! can reload the script when you make changes to your JScript files. ;)


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-27-2009 at 10:19 AM

Uh fantastic! Thanks! :$

I know about the script directory, but i did not thinked that plus reloads xml/js files at every call! Wow!


RE: RE: Very simple script - very simple problem (I hope) by djdannyp on 02-27-2009 at 10:36 AM

quote:
Originally posted by Matti
You don't have to re-import your script at all to see the changes! :O
All script files are stored in Program Files\Messenger Plus! Live\Scripts so if you change a file there, Plus! will load the changes. This goes for any file in your script, so instead of working from some folder outside Plus!, work on your project in Plus!' own folder!
Oh, and enable the script debugger if you haven't already, so Plus! can reload the script when you make changes to your JScript files. ;)

I thought you did have to reimport it to get it to re-read the version numbers and stuff....cos if I change the version number in the xml it doesn't get read by the script preferences window, even after disabling and re-enabling
RE: Very simple script - very simple problem (I hope) by Oceanor on 02-27-2009 at 10:42 AM

At least i can change position and add new controls to my script without re-import all :D


RE: Very simple script - very simple problem (I hope) by djdannyp on 02-27-2009 at 11:03 AM

Look in the Scripting Documentation for 'Testing your Windows' and you will see an interface tester that you can download to test your xml windows


RE: Very simple script - very simple problem (I hope) by Oceanor on 02-27-2009 at 12:34 PM

lol thanks again, useful!


RE: Very simple script - very simple problem (I hope) by matty on 02-27-2009 at 02:09 PM

quote:
Originally posted by Patchou
Edit: for optimisation reasons, the information for every given window is loaded only once. As this would pretty annoying for someone who wants to try to change the files and see the results immediately, you can set a dword value "AlwaysReloadInterfaces=1" in "HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live" to force Plus! to always reload the windows info.