Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: findPublications Arguments: project Description: A command to find publications for a project -> Example input: project='centibots' Page type: webl Render function: tlidRender Module: global Page source: var P; var tmp1; var context; context = NLUtil_InitContext(); //|| go to http://www.google.com context = NLUtil_GetUrl(context, "http://www.google.com", nil, nil); P = NLUtil_GetContext(context, `P`); //|| fill in q with the project context = NLUtil_SetField(context, "q", project); //|| submit the form context = NLUtil_submitForm(context); P = NLUtil_GetContext(context, `P`); //|| submit the form context = NLUtil_submitForm(context); P = NLUtil_GetContext(context, `P`); //|| find all links that contain the project P = NLUtil_GetContext(context,`P`); context = NLUtil_SetContext(context,`a`, Elem(P, `a`) contain Pat(P, `(?i)` + project)); //|| select the first link context = NLUtil_SetContext(context,NLUtil_LastType(context), Select(NLUtil_LastSet(context),0,1)); //|| click it context = NLUtil_clickLink(context); P = NLUtil_GetContext(context, `P`); context = NLUtil_SetContext(context, `P`, P); //|| click on the publications link P = NLUtil_GetContext(context,`P`); context = NLUtil_SetContext(context,`a`, Elem(P, `a`) contain Pat(P, `(?i)publications`)); 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;