What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - Nothing happens!

HELP - Nothing happens!
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. HELP - Nothing happens!
js code:
function OnWndBrowserEvent_CtrlClicked(objWnd, strControlId)
{
    switch(strControlId)
    {
        case "BtnGo": // click of the "Go" button
            if (CmdMode) // if first character of address bar is a "!"
            {
                Wnd.setControlText("EdtAddress", URL);
                var Command;
                var Message = objWnd.GetControlText("EdtAddress");
                var Parameter = new Array();
                var SiteM;
                var SArray = new Array();
                SArray = Message.split(" ");
                Message = "";   
                for (SiteM in SArray)
                {
                    switch(SiteM)                 
                    {
                        case "0":   
                            Command = SArray[SiteM].toLowerCase();
                        break;
                        default:
                            Parameter[SiteM] = SArray[SiteM].toLowerCase();
                            Message += " " + SArray[SiteM];
                        break;
                    }
                }
                if (Command == "!search") // message = !search ...
                {
                    Debug.Trace("> Command: !search");
                    if (Parameter[2] == "") // message = !search ????? <blank>
                    {
                        MsgPlus.CreateWnd("Windows.xml", "WndParameter", 0); // invalid parameter alert
                    }
                    else
                    {
                        if (Parameter[1] == "google") // message = !search google ...
                        {
                            Search = Message.substr(Parameter[1].length + 1);
                            URL = "http://www.google.com/search?q=" + Search;
                            Browser.Navigate2(URL);
                            Debug.Trace("> Now searching for query \"" + Search + "\" (Google).");
                            URL = "";
                            Search = "";
                        }
                        else if (Parameter[1] == "yahoo") // message = !search yahoo...
                        {
                            Search = Message.substr(Parameter[1].length + 1);
                            URL = "http://search.yahoo.com/search?p=" + Search;
                            Browser.Navigate2(URL);
                            Debug.Trace("> Now searching for query \"" + Search + "\" (Yahoo).");
                            URL = "";
                            Search = "";
                        }
                        else
                        {
                            MsgPlus.CreateWnd("Windows.xml", "WndParameter", 0); // parameter alert
                        }
                    }
                }
                else
                {
                    MsgPlus.CreateWnd("Windows.xml", "WndParameter", 0); // parameter alert
                }
            }
            else // not a "!", suggests web address
            {
                Address = objWnd.GetControlText("EdtAddress");
                Wnd.setControlText("EdtAddress", URL);
                URL = Address;
                Browser.Navigate2(URL);
                Debug.Trace("> Now loading page \"" + URL + "\".");
            }
            break;

Enter a web address, and it's fine.  Works perfect.  Enter a command, and...  nothing happens.  I used multiple debug messages to work out that it stops working at the following bit:
js code:
if (Command == "!search")

Why?
02-27-2009 06:02 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: HELP - Nothing happens!
Post the PLSC I can't see any reason why I would need to debug it and see.

Are you getting any errors in the debugger?
02-27-2009 08:18 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - Nothing happens!
No, but I've found out why and fixed it.  I didn't need the code at the start to set the URL from the address bar.  I took it out and it works fine.  :D
02-27-2009 08:19 PM
Profile E-Mail PM Find Quote Report
« 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