What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - Window control to Script Variable!

Pages: (2): « First [ 1 ] 2 » Last »
HELP - Window control to Script Variable!
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. Huh?  HELP - Window control to Script Variable!
How can I set a variable to collect its contents from a window control?

Example: A user types in "test" in a text area, called "EdtMessage", within a script window.  When they click Save, it is stored in a variable called "message", and a toast appears with the "test" message inside.

This post was edited on 02-17-2009 at 01:46 PM by whiz.
02-17-2009 12:30 PM
Profile E-Mail PM Find Quote Report
mynetx
Skinning Contest Winner
*****

Avatar
Microsoft insider

Posts: 1175
Reputation: 33
34 / Male / Flag
Joined: Jul 2007
RE: HELP - Window ontrol to Script Variable!
JScript code:
var message;
 
function OnYourWindowIdEvent_CtrlClicked(objWnd, strControlId) {
    switch(strControlId) {
        case "BtnSave":
            message = objWnd.GetControlText("EdtMessage");
            MsgPlus.DisplayToast("Your script", message);
            // want to close the window? uncomment the following line
            // objWnd.Close(1);
            break;
    }
}

mynetx - Microsoft, enhanced.

You have a problem or issue with Windows, Internet
Explorer or Office?
Send a tweet!
02-17-2009 12:41 PM
Profile E-Mail PM Web Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Window control to Script Variable!
Works great, thanks!  :D

Another question.  Well, three linked questions.  How can you create a window resizable in width but not height?  Can you set a default, maximum and minimum size for it?  And can you set a control (like a text box) width to 100%, so that it stretches across the whole window all the time?
02-17-2009 01:46 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
37 / Male / Flag
Joined: Dec 2002
Status: Away
RE: HELP - Window control to Script Variable!
You are going to need to use the following
XML code:
 
<Window>
    <Position>
        <Resizable Allowed="Verticle">
            <MinWidth>50</MinWidth>
            <MinHeight>50</MinHeight>
        </Resizable>
    </Position>
</Window>


Obviously some fields are left out but you get the idea... note that all the above information is avabile in the scripting documentation you can download...

As for the other question yes you can you just need to initially set the width to stretch then use an anchor on the left and right and bottom.
02-17-2009 01:57 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Window control to Script Variable!
Okay, thanks.

And another thing...  going back to the original question, I have a window for my Instant Response script so that you can change the message/timer.  Is it possible for it to show the current message/timer, set by the user, in the text box by default?
02-18-2009 10:54 AM
Profile E-Mail PM Find Quote Report
mynetx
Skinning Contest Winner
*****

Avatar
Microsoft insider

Posts: 1175
Reputation: 33
34 / Male / Flag
Joined: Jul 2007
RE: HELP - Window control to Script Variable!
JScript code:
objWnd.SetControlText("EdtTimer", strYourTextToSet);

mynetx - Microsoft, enhanced.

You have a problem or issue with Windows, Internet
Explorer or Office?
Send a tweet!
02-18-2009 11:00 AM
Profile E-Mail PM Web Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Window control to Script Variable!
Okay, but...

1) What function would that be?  Would it be like "function OnWndTimerEvent_Created(objWnd, strControlId)", or does it go in the "function OnWndTimerEvent_CtrlClicked(objWnd, strControlId)"?
2) Do I replace "YourTextToSet" with the script variable?
02-18-2009 11:18 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
37 / Male / Flag
Joined: Dec 2002
Status: Away
RE: HELP - Window control to Script Variable!
Well you would want to set the text after the widow loads right...

And yes the the second question...
02-18-2009 12:19 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Window control to Script Variable!
Argh...  nothing's happening!  :(

I've looked in the Scripting Documentation, and there isn't a function for "on the opening of a window", so how do I do it?
02-18-2009 04:02 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
37 / Male / Flag
Joined: Dec 2002
Status: Away
RE: HELP - Window control to Script Variable!
You are correct there is no event for a window created... but when you create a Window you can assign the Windows object to a variable...
Javascript code:
var s = 'this is some text';
var oMyWindow = MsgPlus.CreateWnd('...', '...');
oMyWindow.SetControlText('NameOfTheControl', s);


Reading the documentation fully will help make a lot of sense of things...

This post was edited on 02-18-2009 at 04:13 PM by matty.
02-18-2009 04:12 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On