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!

HELP - Window control to Script Variable!
Author: Message:
whiz
Senior Member
****


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

Although, how do you use this on a check box?  Can it be applied to a true/false variable, because I have tried that, and that doesn't seem to do anything, in terms of what it's supposed to.

Perhaps the code below will help to explain.  This is the bit where it does commands based on what button you press.  The highlighted bit refers to a checkbox in a window.

js code:
var settingEnable = false;
var settingMessage = "/nudge";
var settingTimer = "1000";
var setnoteMesCmd = true;
var setMsgPlusAM = true;
var setSignInAlert = true;

function OnWndControlEvent_CtrlClicked(objWnd, strControlId)
{
    switch(strControlId)
    {
        case "BtnEnable":
            if (settingEnable)
            {
            }
            else
            {
                settingEnable = true;
                var Message = "Activation: enabled";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  Activation: enabled");
            }
            break;
        case "BtnDisable":
            if (settingEnable)
            {
                settingEnable = false;
                var Message = "Activation: disabled";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  Activation: disabled");
            }
            else
            {
            }
            break;
        case "BtnSave":
            if (settingMessage==objWnd.GetControlText("EditMessage"))
            {
            }
            else if (objWnd.GetControlText("EditMessage") == "")
            {
                var Message = "New message was not set:\n message was left blank!";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New message was not set: message was left blank!");
            }
            else
            {
                settingMessage = objWnd.GetControlText("EditMessage");
                var Message = "New message: " + settingMessage;
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New message: " + settingMessage);
                setnoteMesCmd = (/^\/[^\s\/]+\s*[\s\S]*$/.test(settingMessage));
                objWnd.Close(1);
                break;
            }
            if (settingTimer==objWnd.GetControlText("EditTimer"))
            {
                var Message = "New timer was not set:\n timer was left blank!";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New timer was not set: timer was left blank!");
            }
            else if (objWnd.GetControlText("EditTimer")=="")
            {
                var Message = "New timer was not set:\n timer was left blank!";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New timer was not set: timer was left blank!");
            }
            else if (objWnd.GetControlText("EditTimer")<100)
            {
                var Message = "New timer was not set:\ntimer was under 100ms!";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New timer was not set: timer was under 100ms!");
            }
            else if (typeof parseInt(objWnd.GetControlText("EditTimer")) === 'number' ? parseInt(objWnd.GetControlText("EditTimer")) : 0)
            {
                settingTimer = objWnd.GetControlText("EditTimer");
                var Message = "New timer: " + settingTimer + "ms";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New timer: " + settingTimer + " milliseconds");
                objWnd.Close(1);
                break;
            }
            else
            {
                var Message = "New timer was not set:\ntimer used invalid characters!";
                Message = MsgPlus.RemoveFormatCodes(Message);
                MsgPlus.DisplayToast("Instant Response", Message);
                Debug.Trace("Instant Response  |  New timer was not set: timer used invalid characters!");   
            }
>>>            if (setMsgPlusAM==objWnd.GetControlText("ChkPlusAMStyle"))<<<
>>>            { <<<
>>>            } <<<
>>>            else <<<
>>>            { <<<
>>>                setMsgPlusAM = objWnd.GetControlText("ChkPlusAMStyle"); <<<
>>>                var Message = "Plus! style: " + setMsgPlusAM; <<<
>>>                Message = MsgPlus.RemoveFormatCodes(Message); <<<
>>>                MsgPlus.DisplayToast("Instant Response", Message); <<<
>>>                Debug.Trace("Instant Response  |  Plus! style: " + setMsgPlusAM); <<<
>>>            } <<<
            objWnd.Close(1);
        case "BtnCancel":
            objWnd.Close(1);
            break;
    }
}
02-18-2009 04:47 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP - Window control to Script Variable! - by whiz on 02-17-2009 at 12:30 PM
RE: HELP - Window ontrol to Script Variable! - by mynetx on 02-17-2009 at 12:41 PM
RE: HELP - Window control to Script Variable! - by whiz on 02-17-2009 at 01:46 PM
RE: HELP - Window control to Script Variable! - by matty on 02-17-2009 at 01:57 PM
RE: HELP - Window control to Script Variable! - by whiz on 02-18-2009 at 10:54 AM
RE: HELP - Window control to Script Variable! - by mynetx on 02-18-2009 at 11:00 AM
RE: HELP - Window control to Script Variable! - by whiz on 02-18-2009 at 11:18 AM
RE: HELP - Window control to Script Variable! - by matty on 02-18-2009 at 12:19 PM
RE: HELP - Window control to Script Variable! - by whiz on 02-18-2009 at 04:02 PM
RE: HELP - Window control to Script Variable! - by matty on 02-18-2009 at 04:12 PM
RE: HELP - Window control to Script Variable! - by whiz on 02-18-2009 at 04:47 PM
RE: HELP - Window control to Script Variable! - by matty on 02-18-2009 at 05:26 PM
RE: HELP - Window control to Script Variable! - by whiz on 02-18-2009 at 05:51 PM


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