js code:
function OnWndBrowserEvent_CtrlClicked(objWnd, strControlId)
{
switch (strControlId)
{
case "BtnGo":
if (CmdMode)
{
CmdMode = false;
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")
{
Debug.Trace("> Command received: !search");
if (Parameter[2] == undefined)
{
ParamError();
}
else if (Parameter[2] == "")
{
ParamError();
}
else
{
if (Parameter[1] == "google")
{
>>> Search(Parameter[1].length + 1,Parameter[1]);<<<
}
else if (Parameter[1] == "yahoo")
{
>>> Search(Parameter[1].length + 1,Parameter[1]);<<<
}
else
{
ParamError();
}
}
}
}
}
}
js code:
function Search(Term,Engine)
{
Sound("StartLoad");
Wnd.setControlText("EdtAddress", Address);
var URL;
if (Engine == "google")
{
URL = "http://www.google.com/search?q=";
}
else if (Engine == "yahoo")
{
URL = "http://search.yahoo.com/search?p=";
}
>>> Browser.Navigate2(URL + Term);<<<
>>> Debug.Trace("> Searching for query \"" + Term + "\".");<<<
}
If I type "!search google test page", the term is from parameter 2 onwards ("test page"), and the search engine is parameter 1 ("google"). However, typing this in results in a Google results page for the term "7".
Similarly, replace "google" with "yahoo", and the term, no matter what is entered, is set to "6". I've also tried using variables to store the engine/term, but the same happens. Why?