Source: site.view [edit]
Function name: findWeather
Arguments: zipcode
Description: A command to find weather for a zipcode
Page type: webl
Render function:   tlidRender
Module: global

Page source:

var P;
var context;

context = NLUtil_InitContext();

//|| go to http://www.weather.com
context = NLUtil_GetUrl(context, "http://www.weather.com", nil, nil);
P = NLUtil_GetContext(context, `P`);

//|| find all forms that contain "Local Weather"
P = NLUtil_GetContext(context,`P`);
context = NLUtil_SetContext(context,`form`, Elem(P, `form`)  contain Pat(P, `(?i)` + `Local Weather`));

//|| field where is the zipcode
context = NLUtil_SetField(context, "where", zipcode);

//|| submit the form
context = NLUtil_submitForm(context);
P = NLUtil_GetContext(context, `P`);

//|| find all rows that directly contain "Feels Like"
P = NLUtil_GetContext(context,`P`);
context = NLUtil_SetContext(context,`tr`, Elem(P, `tr`)  directlycontain Pat(P, `(?i)` + `Feels Like`));

if Size(OPTIONALARGS) == 0 then
   NLUtil_LastValue(context);
else
   context;
end;