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
context = NLUtil_GetUrl(context, "", 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