Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: luckySearchUsingMslive Arguments: term Description: A command to lucky search for a term using MSLive -> Example input: term='Adam Cheyer' Page type: webl Render function: tlidRender Module: global Page source: var P; var tmp1; var context; context = NLUtil_InitContext(); //|| go to http://www.live.com context = NLUtil_GetUrl(context, "http://www.live.com", nil, nil); P = NLUtil_GetContext(context, `P`); //|| find all forms P = NLUtil_GetContext(context,`P`); context = NLUtil_SetContext(context,`form`, Elem(P, `form`) ); //|| field q is the term context = NLUtil_SetField(context, "q", term); //|| submit the form context = NLUtil_submitForm(context); P = NLUtil_GetContext(context, `P`); //|| find all links that come after options P = NLUtil_GetContext(context,`P`); context = NLUtil_SetContext(context,`a`, Elem(P, `a`) after Pat(P, `(?i)` + `option`)); //|| select the second link context = NLUtil_SetContext(context,NLUtil_LastType(context), Select(NLUtil_LastSet(context),1,2)); //|| click it context = NLUtil_clickLink(context); P = NLUtil_GetContext(context, `P`); context = NLUtil_SetContext(context, `P`, P); //|| return the page if Size(OPTIONALARGS) == 0 then NLUtil_LastValue(context); else context; end;